From patchwork Thu Feb 10 03:43:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 1590779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=BFEvFVV4; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=PblpbGiv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JvN0f235gz9s8s for ; Thu, 10 Feb 2022 14:44:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=9iluK+4aCUaubk1e7br6DwVvQpUtTeUtYkfjjktq3Zc=; b=BFE vFVV4UzphMKu9NQCUVtowxZp835oKcygd7zq6p1UaMzoPiIPPuKnamQq1gSi3RL1K5Xfxwtdi3PUq kx0uK/5g3+n7RaM6642w7H+gO4jYqTlxfu0zkn5PPijzQplH9S7EeUJiWwItQ4mwWSEkOpDN5/HNl 1Zm3CP8hPnyZQZb9IrQNLnLTYrKarW2svW+J55me9b4cgFXdIZWIfL/Y9nYfrYWrr+Cbh7gEMuOC2 wnyEWGkiziM+eYeG7k7yro8Buc4PoB2y+sj4FTFaWQkxsosRW5/YcIuOHbhD/wYkLbknZiFoRlaTy iDi6KdD1djuU01c1seXwF2Ahlt3OPQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI0NY-002Sqj-G3; Thu, 10 Feb 2022 03:44:20 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI0NN-002SoB-6n for linux-um@lists.infradead.org; Thu, 10 Feb 2022 03:44:10 +0000 Received: by mail-yb1-xb49.google.com with SMTP id a32-20020a25ae20000000b0061db8f89e46so9330587ybj.14 for ; Wed, 09 Feb 2022 19:44:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=qWciCl5ZnA9cee9VzBNrbmZE8MiSApc+U+pccH0ywtA=; b=PblpbGivAgUrwkOht9582vzXVasv4VMvpMz3lvBIGDiBjYaQgnqS7+IZOblr5OWlFA RZD1fNqXxa3Myt8T4AVZWn/J725vs43n11uyMfkQxXSgvQ8Euql15tidstY2FYvI1Nr9 L0pkNONCYIbptyxWeTfkQF9EPnDmzpZhGbi39EDSjn/65lpjb/U8U4lfaToQ4S8DYgB+ TQKb5tuZUiEw8rSMF1Xy2rpcImcHUuN7Ea3bOwVx+GSmoJKQrEo66aGtC66ZldMvaAOY iMTVOkfZsFas+s2NtzEG04oM5Xml5EbKeZhbPVZbUspFM2HBKDJ3hbAMn3472WuBjpbN jylQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=qWciCl5ZnA9cee9VzBNrbmZE8MiSApc+U+pccH0ywtA=; b=qO8mCzV6rBxmJ+QtB0V44LnvKcgdBfodE2VbpXcEgliiIxtrrsh1qhYsjRDNn3xFnh TZEsgbcBJpFwg7gCDSb2wQthu0epS6is3jgjgzjyJqQQuQM6GY0BSejgHeGtd4CBLxyF 8lZgbq2tMhk/flFS0sPA5NRMAASWFAJr1jDEVLGhlfuJWASrQb57T2hxt9hXAT074L9O bMux1m6gfnlc2zOQnq5MOeZTbwGfKmOfXhubOb9qZ3ryJTeW8YGckbXyWKuJ4oZvup9H mvCeHJSQWzvjt2dxOvddfNglilkiYZMqhu4WGHAsnwlusCorCi8x4FQx1QVgb+hHEEzy cjlg== X-Gm-Message-State: AOAM5326lZe8BRKhidaAfHHU4kLPx11rHIfJ2L/bI1kfJiULWsoEksmX 9SSS7/sm8l5uLK+aylJLVkBH0/x+Fhqbxg== X-Google-Smtp-Source: ABdhPJyRin3QH5+g4IN2NFhJb+pUdb70CkVQBrXXRWnw9X9KybCGXHGiOSdS1drI6ORnR2CMcfjFDII3JsZ9UA== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a0d:f742:: with SMTP id h63mr5655549ywf.410.1644464645575; Wed, 09 Feb 2022 19:44:05 -0800 (PST) Date: Thu, 10 Feb 2022 11:43:53 +0800 Message-Id: <20220210034353.1065703-1-davidgow@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH] um: Cleanup syscall_handler_t definition/cast, fix warning From: David Gow To: Jeff Dike , Richard Weinberger , Anton Ivanov , Al Viro Cc: David Gow , x86@kernel.org, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220209_194409_341118_1C0E292A X-CRM114-Status: GOOD ( 11.20 ) X-Spam-Score: -7.7 (-------) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The syscall_handler_t type for x86_64 was defined as 'long (*)(void)', but always cast to 'long (*)(long, long, long, long, long, long)' before use. This now triggers a warning (see below). Define syscall_handler_t as the latter instead, and remove the cast. This simplifies the code, and fixes the warning. Content analysis details: (-7.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:b49 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The syscall_handler_t type for x86_64 was defined as 'long (*)(void)', but always cast to 'long (*)(long, long, long, long, long, long)' before use. This now triggers a warning (see below). Define syscall_handler_t as the latter instead, and remove the cast. This simplifies the code, and fixes the warning. Warning: In file included from ../arch/um/include/asm/processor-generic.h:13 from ../arch/x86/um/asm/processor.h:41 from ../include/linux/rcupdate.h:30 from ../include/linux/rculist.h:11 from ../include/linux/pid.h:5 from ../include/linux/sched.h:14 from ../include/linux/ptrace.h:6 from ../arch/um/kernel/skas/syscall.c:7: ../arch/um/kernel/skas/syscall.c: In function ‘handle_syscall’: ../arch/x86/um/shared/sysdep/syscalls_64.h:18:11: warning: cast between incompatible function types from ‘long int (*)(void)’ to ‘long int (*)(long int, long int, long int, long int, long int, long int)’ [ -Wcast-function-type] 18 | (((long (*)(long, long, long, long, long, long)) \ | ^ ../arch/x86/um/asm/ptrace.h:36:62: note: in definition of macro ‘PT_REGS_SET_SYSCALL_RETURN’ 36 | #define PT_REGS_SET_SYSCALL_RETURN(r, res) (PT_REGS_AX(r) = (res)) | ^~~ ../arch/um/kernel/skas/syscall.c:46:33: note: in expansion of macro ‘EXECUTE_SYSCALL’ 46 | EXECUTE_SYSCALL(syscall, regs)); | ^~~~~~~~~~~~~~~ Signed-off-by: David Gow --- I couldn't find a reason for the two conflicting function types here, but it's possible I'm missing one. At the very least, this change didn't seem to break anything on my system. arch/x86/um/shared/sysdep/syscalls_64.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/um/shared/sysdep/syscalls_64.h b/arch/x86/um/shared/sysdep/syscalls_64.h index 48d6cd12f8a5..b6b997225841 100644 --- a/arch/x86/um/shared/sysdep/syscalls_64.h +++ b/arch/x86/um/shared/sysdep/syscalls_64.h @@ -10,13 +10,12 @@ #include #include -typedef long syscall_handler_t(void); +typedef long syscall_handler_t(long, long, long, long, long, long); extern syscall_handler_t *sys_call_table[]; #define EXECUTE_SYSCALL(syscall, regs) \ - (((long (*)(long, long, long, long, long, long)) \ - (*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(®s->regs), \ + (((*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(®s->regs), \ UPT_SYSCALL_ARG2(®s->regs), \ UPT_SYSCALL_ARG3(®s->regs), \ UPT_SYSCALL_ARG4(®s->regs), \