From patchwork Thu Apr 27 11:23:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 13225386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A087C77B73 for ; Thu, 27 Apr 2023 11:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243525AbjD0LX6 (ORCPT ); Thu, 27 Apr 2023 07:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243485AbjD0LX4 (ORCPT ); Thu, 27 Apr 2023 07:23:56 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FBC34C00; Thu, 27 Apr 2023 04:23:55 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id 341F2C020; Thu, 27 Apr 2023 13:23:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594634; bh=XE5XD0Y2KMfY2VWjCTGCAbFyRUZoNpeelcS15tqOd2c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UTjLPfBEKm3VwuvvVgE8DvyBsgqd8/dGffZZdI6rJy8jINzh1zCXNtBTI2KBCAE1p hCSi0r9+hX8SsYKb6VTVRr81KT2ATBRB/gaj4ElMXa4QdUbVaeVm3ptqkoxOc1ASWx 1jl6igxJvlYtMWnkkquO9qzdm/w3hypBsCiuy/p5d1eLlDEXwoWcgE9rznZ6OpatE7 g7wldRNwMrEm1Xfk3DfOcZ4lfDNRqnCv/e0rc2PocgQ8f/r8U1Nkuci/SOBfuC65Ye EESRhLa5tLmAERAulF2XBykdYTkTjdiAygDjHYqtqalXooIn99fKrytxwbWua08yW7 MAOhYKJE/4WLA== Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 41E5FC022; Thu, 27 Apr 2023 13:23:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594633; bh=XE5XD0Y2KMfY2VWjCTGCAbFyRUZoNpeelcS15tqOd2c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=H2wykJYBIe2MyU/j9JHCjTRak3S+WYIII6QDn1/NJVNvyJwoDlcjERlyXJ992v41V zbFqJNtQbqufnDnAm3Cg/K3NytYMCar5nO1lG8yrhoZiP3Vb1c+0X7OjRoaaEooD/D DFeokklU8RjWnCyqhHMGo1tsxErMtzzYPqXxUH6RKylDCZnvG4rxpaZaAiOTFlhbEU fsGxWlbGlvIPb2+oTHTOh1gvJ0URGNtq7cDT2bjpjkxOW7eTG5zKXrVpjsotQkZJcx EJfGRyA7J8p9E1jnGhquv0kAJeH+SrKFme28CE1WMerR27WQR1YAyT/p6XPaY7Zqfo EidKLs8R8TVcg== Received: from [127.0.0.2] (localhost [::1]) by odin.codewreck.org (OpenSMTPD) with ESMTP id 36370512; Thu, 27 Apr 2023 11:23:38 +0000 (UTC) From: Dominique Martinet Date: Thu, 27 Apr 2023 20:23:34 +0900 Subject: [PATCH 1/5] 9p: fix ignored return value in v9fs_dir_release MIME-Version: 1.0 Message-Id: <20230427-scan-build-v1-1-efa05d65e2da@codewreck.org> References: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> In-Reply-To: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> To: Eric Van Hensbergen , Latchesar Ionkov , Christian Schoenebeck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Dominique Martinet X-Mailer: b4 0.13-dev-f371f X-Developer-Signature: v=1; a=openpgp-sha256; l=1335; i=asmadeus@codewreck.org; h=from:subject:message-id; bh=RUrHjm09yOZeR53rq5HPPNCIO2yy4QcgPbGLIejJm5I=; b=owEBbQKS/ZANAwAIAatOm+xqmOZwAcsmYgBkSls6SD/j9mD1STx6vrnIP0mSXa6M3O2m5VS+g yolZS1hCoqJAjMEAAEIAB0WIQT8g9txgG5a3TOhiE6rTpvsapjmcAUCZEpbOgAKCRCrTpvsapjm cPkFD/9/tTKymkW7WrHAmUNNzET2COeBpFW8CxETv/feWu+NQ4/5Y1kssQiC3J/JiPDz2sCSfOv hu8eD0TaZNvGcck9w+kx6QowkDpIN+FyQKAuXJvm4ILc4Hy/skXWcScNCpbvy7pJyst6ohfsLny LpsdT54rxQcPJ4xFraC6HtsoXCR7W12hUIaJPSRt86oIX6xqMY+OY6kfoY+CFzpD5lm2b9bcq6G 5qhVUNnbcysV++mqsT0ptTFI/1qIDnOQSMjVwbSu4u03ZgMHpWt5L5a+7OIAdoAcEH195sR7F54 hd954Oj1wnd25tqvoP16mH8hg9tSvnAaURWB07Ma/r88WC1J+nNPe47i7lxbOV3G2w45JtOewBk 3YvZWRvT2SxYiOnho1Df85qg5pMtodCaTW+ZNwvYoEU3O6meiCcTm3ld7U/4sPhkLmdInXCLvdX 6b6VW62YbmaBemTrUprDX/ILMdRkEA/cLBvqQB2enYnjk81ViVvX1MweZcHaIFO2+h2+PRobQPw hPPm2EuZYpfvQK1StrrkIXzb2w/2MU1ZWuiKnLeUOYvlxWnvbU6cH+Jgu20aGKfeZULteeU+Iv8 0/VuJX0DaMV0KRczcmKFTn6NPISsbr4ioKPen3ut/qxjsUx1Tivi0yxRLZhEUloF4kZFk4ViqCG 5GCE/NbXVsS6wPQ== X-Developer-Key: i=asmadeus@codewreck.org; a=openpgp; fpr=B894379F662089525B3FB1B9333F1F391BBBB00A Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org retval from filemap_fdatawrite was immediately overwritten by the following p9_fid_put: preserve any error in fdatawrite if there was any first. This fixes the following scan-build warning: fs/9p/vfs_dir.c:220:4: warning: Value stored to 'retval' is never read [deadcode.DeadStores] retval = filemap_fdatawrite(inode->i_mapping); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Dominique Martinet Reviewed-by: Simon Horman --- fs/9p/vfs_dir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 289b58cb896e..54bb99f12390 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c @@ -209,7 +209,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) struct p9_fid *fid; __le32 version; loff_t i_size; - int retval = 0; + int retval = 0, put_err; fid = filp->private_data; p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n", @@ -222,7 +222,8 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) spin_lock(&inode->i_lock); hlist_del(&fid->ilist); spin_unlock(&inode->i_lock); - retval = p9_fid_put(fid); + put_err = p9_fid_put(fid); + retval = retval < 0 ? retval : put_err; } if ((filp->f_mode & FMODE_WRITE)) { From patchwork Thu Apr 27 11:23:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 13225387 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D69E9C77B61 for ; Thu, 27 Apr 2023 11:24:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243416AbjD0LYK (ORCPT ); Thu, 27 Apr 2023 07:24:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243636AbjD0LX7 (ORCPT ); Thu, 27 Apr 2023 07:23:59 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B125B86; Thu, 27 Apr 2023 04:23:57 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id E3BB0C023; Thu, 27 Apr 2023 13:23:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594634; bh=s+rCY3PhNsjKtAMo7ceBkqmXMZyC1GJyZBLyjIlkj7k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BKMeJuqCAs7gz87ccJfjFExzkNjMiSf/Hrt+lG/vd7cp1BFvOaNAKkEYyEe6kvVlZ wv8ZG02JYJpZsejUbhty0V8HrOXCq7QD+xn6lnvLzzrGQqG4RyU+kZqTnssQ43QS0n bPYO4LfxDOPFbfCwuh87fJj9fEL0hb7w9PzQ1aR29UlOW2TIXLC0AoZ5VlU7mDcg7P xWUWuLpe+hlxIpYWp0KtaX9D6aKuBrc3JifIBrNqMcuyaYgIWm59P0iHXG3o3oReIt iVTBzVpY2Vad0a+BXN2E4f9SBwmRVOy3PTeXMwOxs+ICdtnAG77zniLBvvz1xIB/sV I7y4tzwKLz2Qw== Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 11A22C023; Thu, 27 Apr 2023 13:23:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594633; bh=s+rCY3PhNsjKtAMo7ceBkqmXMZyC1GJyZBLyjIlkj7k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZlmRSHYPRZOSAJgH54xjFLq2yzzElppfvubM0NynWTo1tmNsz3qHQbcee2Isz7ceY 3yZTE8Mq4ZakBNtUU3Z8JW+zsI0+DSqJJVDmSRze2XwOiaz+0HAcDpwo0KTz4ZnMRj xW5UpirTNghyfFGznRoDpDfSKqDBV2VG2eF9WPOaZmZ30IJK7qBPrJQKZsZ1nF6GSz IITwI9V4yauR7QtwkL+88D1Cch00cRg2I1Bhoy4I7JswnvdZfWwu2WwaGvRqhzlXWj PjOvZbgBLlASMztmYMZkMIa79mkCUofMCdEtLZ79Kry7mT13q2+X5bK367zWB7+Bpu aJPlWpR7W1OgA== Received: from [127.0.0.2] (localhost [::1]) by odin.codewreck.org (OpenSMTPD) with ESMTP id 224b0460; Thu, 27 Apr 2023 11:23:38 +0000 (UTC) From: Dominique Martinet Date: Thu, 27 Apr 2023 20:23:35 +0900 Subject: [PATCH 2/5] 9p: virtio: fix unlikely null pointer deref in handle_rerror MIME-Version: 1.0 Message-Id: <20230427-scan-build-v1-2-efa05d65e2da@codewreck.org> References: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> In-Reply-To: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> To: Eric Van Hensbergen , Latchesar Ionkov , Christian Schoenebeck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Dominique Martinet X-Mailer: b4 0.13-dev-f371f X-Developer-Signature: v=1; a=openpgp-sha256; l=1336; i=asmadeus@codewreck.org; h=from:subject:message-id; bh=uAxOy5RN+SshQ0IlB7WUwAUYTCBMSrvtKIu4Ytp0HO8=; b=owEBbQKS/ZANAwAIAatOm+xqmOZwAcsmYgBkSls6sv0W5uY/qDr+rJzbHgv/8wIRfEH4Mb226 8L3vvejGgOJAjMEAAEIAB0WIQT8g9txgG5a3TOhiE6rTpvsapjmcAUCZEpbOgAKCRCrTpvsapjm cIY9D/sG6txif6f/ao9Jzx0NwqwbUftDmaENl23wBkDzshsr8eDrKr1JyNsvgNIy0v6ToBG4q+1 aQ80V4X+/VM0nOAJ+fynVm4z21W1K2oNfgXRTdYzERfDUMkSPlzuiowECY/hJzeyFSoqyNaAFGW 1lHtKoo6hdOmG9Wgr/0GmRXtQUYk+SXyl0fOX7et/7ASmTSv8XSZtazNY3FNX1SiFotyIJ7rxN+ +TqIuai/zi4c/PeFTzOIUUUoTLUJYKleI0dMED7bGvTY1l4wqftWD15r76gcjO1zzbkFgrFn9DN vu8Srzkh7Ctmrw1aJR7p+ot7WeHZgD4sxxXcbySpZ24ziw4RRgaJuVd5HZsJ7fTuYwRNILXEfZD u3Yji+B2kJJqDi1PV6gn/9T9EbH8ftvqzUB7J8EU93kLbq/n4wF+trJoFD3FQAOt9LBP5ry+U/y KjdBLGKFgJGY1tpkOV+XXZnUCktQooqA2IH1zQNntrsjVfVujlYEnRRqVRbL/Ybj9S4qNEyAehQ SVVCiT9T9SXz+1h6t3lZU6RMrLPOtZq9qbKNmP8lQUJGUx2grjFs6GbSQfGjKvLVsBI9PqTqJ7l it7pKb4GSLaR56oan4Iy1BYy/bbGYcwxYbTmW73ZrahU5hD+KECcXRm3ORCS59QGNxiNtvY0pus ibuiffORyhotsvg== X-Developer-Key: i=asmadeus@codewreck.org; a=openpgp; fpr=B894379F662089525B3FB1B9333F1F391BBBB00A Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org handle_rerror can dereference the pages pointer, but it is not necessarily set for small payloads. In practice these should be filtered out by the size check, but might as well double-check explicitly. This fixes the following scan-build warnings: net/9p/trans_virtio.c:401:24: warning: Dereference of null pointer [core.NullDereference] memcpy_from_page(to, *pages++, offs, n); ^~~~~~~~ net/9p/trans_virtio.c:406:23: warning: Dereference of null pointer (loaded from variable 'pages') [core.NullDereference] memcpy_from_page(to, *pages, offs, size); ^~~~~~ Signed-off-by: Dominique Martinet Reviewed-by: Simon Horman --- net/9p/trans_virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 3c27ffb781e3..2c9495ccda6b 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -384,7 +384,7 @@ static void handle_rerror(struct p9_req_t *req, int in_hdr_len, void *to = req->rc.sdata + in_hdr_len; // Fits entirely into the static data? Nothing to do. - if (req->rc.size < in_hdr_len) + if (req->rc.size < in_hdr_len || !pages) return; // Really long error message? Tough, truncate the reply. Might get From patchwork Thu Apr 27 11:23:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 13225389 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B1A9C77B7F for ; Thu, 27 Apr 2023 11:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243737AbjD0LYQ (ORCPT ); Thu, 27 Apr 2023 07:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243711AbjD0LYK (ORCPT ); Thu, 27 Apr 2023 07:24:10 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2335FE0; Thu, 27 Apr 2023 04:24:03 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id 24C3FC021; Thu, 27 Apr 2023 13:24:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594640; bh=ktwVTjkmEChjhY/kRpODTnUXv8zYYBOjSBS7MBgR468=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YiL6ZYJi+YLRa0svXQ6itVhYqBapUedCZ4a+ZF/jn5/jg/WQccb6l3L6jcFfooyzu DrunOhIJfUZcnqtGy4jKULDC1x5RqQcft4G5S7CpVhu6hqS3q7AcJi5Y9ncYRLitJX 7TKlxFwaeEBLxbj0CdOpyAvSyBHMq7/T/iNzlDd2E6HRzWitgTMP5zk/Gk52ZS4mJd 3MygLf0G1/ye2m01NnAMMKv5HJKMTLcGEkhZfeEpz2Jxth9oXyz2fvbgxgFe8XYP9Q gcRgYiTVgn2wYP1LTuA1SiucHQDqZ//hogpK9yQswv5DR4ZNGsbJc2dsgpW+/8Y7oS YD1btsr+EUffg== Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 2F438C009; Thu, 27 Apr 2023 13:23:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594639; bh=ktwVTjkmEChjhY/kRpODTnUXv8zYYBOjSBS7MBgR468=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GaPAOn9ax4E4wXFYH9FS+G/gn+WN8TnFfXvp/VD6Wr1pstK3XxHXSMVNHqAkxzUxb vXr7yXzu1V6sn6k7t5eY7xVCFHrn1aRD36Gi/ktPRn1mOaH97Zhj+ZJ07WiI+Sh/+7 PweTC8jln3zqzitON0FKtdXhM31TisXEoatiLlom7MaKFZLAKxw6OIylDIyTwT2+J0 KXBGojHZXOqAoAUiSNNynMQMhF3OIStrkizhMJP4vLxoEy+yeWa/j4lDXkHZGGS265 3IwECDv8OH2AzPyDfSDddoiAGaX8cSdWmyctMvvlThKxwwghlyQMpkO8ebxQXsQAvV 6NKgXWyaHiD2w== Received: from [127.0.0.2] (localhost [::1]) by odin.codewreck.org (OpenSMTPD) with ESMTP id d47cdf86; Thu, 27 Apr 2023 11:23:38 +0000 (UTC) From: Dominique Martinet Date: Thu, 27 Apr 2023 20:23:36 +0900 Subject: [PATCH 3/5] 9p: virtio: make sure 'offs' is initialized in zc_request MIME-Version: 1.0 Message-Id: <20230427-scan-build-v1-3-efa05d65e2da@codewreck.org> References: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> In-Reply-To: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> To: Eric Van Hensbergen , Latchesar Ionkov , Christian Schoenebeck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Dominique Martinet X-Mailer: b4 0.13-dev-f371f X-Developer-Signature: v=1; a=openpgp-sha256; l=1151; i=asmadeus@codewreck.org; h=from:subject:message-id; bh=MTmAPJ1UlUfirYv8DGy7tXkrUTvjMEZVRvmnf3jNkLY=; b=owEBbQKS/ZANAwAIAatOm+xqmOZwAcsmYgBkSls6AeJis7+yhZZ2w56xFaCjuExc7wUz20f1l IVqwQ9n4JGJAjMEAAEIAB0WIQT8g9txgG5a3TOhiE6rTpvsapjmcAUCZEpbOgAKCRCrTpvsapjm cGisD/9Eq2d3KddRTicpI39DZzltwawS/nAxGl9GSeTqTSN4fm+hsRzlV6MHofvjXhxVCdsA7BO b/5apjazGZZIOD8cSC3LGikEEGhySt7vSuf0abg5Ux1/IekDadvtFVpnTSEYeILBE82+c9e4uyQ 6QKzx7VNOBriS0/Q3Q9MXiP1dEOoLIVJhxIWy/wJHGgx23Kx0k7JdNexzmrisfoWJerNhZN2N7w wZg4RvMrPJCyi5rvCs7NfAxP08M/91aYLqnYlRJl3nDrEJd7EsO6/gEcmlW3xm+UmVSHGULu4Em Ue2RWrTE9UderjLPqKiLvftYTHj5Cpyt5duZ6sU9h/bMMw4Z0IK/u++Lr9mYB+XGRWXBhdft9ZC uI+frkrXkGJP0NGFyIfrsDSbYs1Ma9ARicxfXFM2xXutUJZvpsF6aNBiIUK0XPS3nIRIjSt0HHD 4JJFvQ6zfkcb1hcNrfrntwneTVaYoBMlVoZHTdYOX1HmoOb88NH1QWHY2b7DgtBS/91dsGqLpIy x0cWtAMWp6WvdnwViuzJ038G+Hq6yvc+2bZBDerAgQc88Wo/EHpRivMWKmeJOAmHibF/PYtMNbM 4OKQmEhlz+Ho9beZRwgyqiIPxsJ4ZxydEl0ONnaa7eX10VgCyuq70KwBM4k3FEMw6yBgTU2Y2dL JXY+AQLEaBGbZbA== X-Developer-Key: i=asmadeus@codewreck.org; a=openpgp; fpr=B894379F662089525B3FB1B9333F1F391BBBB00A Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Similarly to the previous patch: offs can be used in handle_rerrors without initializing on small payloads; in this case handle_rerrors will not use it because of the size check, but it doesn't hurt to make sure it is zero to please scan-build. This fixes the following warning: net/9p/trans_virtio.c:539:3: warning: 3rd function call argument is an uninitialized value [core.CallAndMessage] handle_rerror(req, in_hdr_len, offs, in_pages); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Dominique Martinet Reviewed-by: Simon Horman --- net/9p/trans_virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 2c9495ccda6b..f3f678289423 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -428,7 +428,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, struct page **in_pages = NULL, **out_pages = NULL; struct virtio_chan *chan = client->trans; struct scatterlist *sgs[4]; - size_t offs; + size_t offs = 0; int need_drop = 0; int kicked = 0; From patchwork Thu Apr 27 11:23:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 13225388 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54DD1C77B73 for ; Thu, 27 Apr 2023 11:24:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243686AbjD0LYO (ORCPT ); Thu, 27 Apr 2023 07:24:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243709AbjD0LYK (ORCPT ); Thu, 27 Apr 2023 07:24:10 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA9B5BAC; Thu, 27 Apr 2023 04:24:02 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id 9D09BC01A; Thu, 27 Apr 2023 13:24:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594641; bh=WAcni6OXNNhfIsk21LRpOs0ssDNtEseYLnTlcemrY2g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=yf/eyQK5ut+JO1qiFPve6ahEGOQVDHwu6RdIhT+iOyUTZQRDCjEZCE3a4iSkr7FOg /LNUJbVSIAjOM1q8bL0ZNB4t0iIoyO6bdkOgNyQb1lrWdgMi47MuaXK0dVMd2nEwAy aCO36BNaRBeSw10lapZsDMb5fv6OuqU1/Rg+V7yogrXOaBTAqH58rr02RuYk+tA4zX P9ide9MQ5zMR6vo56kHkjX4XtgdL01yoeAr6Nr83XwINNNl3s296M4G45j9+jRQtXX x37jnWNUkQ3CfUEij8wlxNCVvBh7trmMit9NoQyGW14Q9fW9ISIJEHp6cm+y0i0VQu FjdMP6gebicZA== Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 803C7C027; Thu, 27 Apr 2023 13:23:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594640; bh=WAcni6OXNNhfIsk21LRpOs0ssDNtEseYLnTlcemrY2g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Wt+7+6xvO9HpFj/9+TH6G66Z+k2kv/ZAxBqrO7vZuLcrXeBBpqIPZCrKilnbwH3iL rjxCDHyw3prxovaCXgbDEd+Bg+933sV1tqiur43VXCLZcdLrLZ0KI8JkcHCo4NvQsy ESK9exMRPQkoTeiaOV3JIATVreJr7FbH8Gzy/Ofu0vFOYWSoF4hBwM0V6ie80CFxov C5WIO/y4vCSvBVWwmxDWtrTPyyrmyPpAmWXLj0Zr0U4kcGG+NwaJ3sjbltAHlAVEPZ UBQiNsoEPocMRkY8iIm9fL/Ke7iS5ANVuG0xKXEf+vfvuiGVp3D4Oa9r5SYqcxnljJ 4YqGDXoum1JCA== Received: from [127.0.0.2] (localhost [::1]) by odin.codewreck.org (OpenSMTPD) with ESMTP id 62ba5dfd; Thu, 27 Apr 2023 11:23:38 +0000 (UTC) From: Dominique Martinet Date: Thu, 27 Apr 2023 20:23:37 +0900 Subject: [PATCH 4/5] 9p: virtio: skip incrementing unused variable MIME-Version: 1.0 Message-Id: <20230427-scan-build-v1-4-efa05d65e2da@codewreck.org> References: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> In-Reply-To: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> To: Eric Van Hensbergen , Latchesar Ionkov , Christian Schoenebeck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Dominique Martinet X-Mailer: b4 0.13-dev-f371f X-Developer-Signature: v=1; a=openpgp-sha256; l=1446; i=asmadeus@codewreck.org; h=from:subject:message-id; bh=ZMF8fKgy6MruQWkvDgsGF7Eu9N0vj7dpVoHPZqEHFx0=; b=owEBbQKS/ZANAwAIAatOm+xqmOZwAcsmYgBkSls6JkS5vYc7mI/MehYXF+/hAVc7drQX7F6Xt Z8djcyEa4CJAjMEAAEIAB0WIQT8g9txgG5a3TOhiE6rTpvsapjmcAUCZEpbOgAKCRCrTpvsapjm cE7lD/45MIokCD08AcJcd9l8YjKbW6ivA5vwiktynC6acsoejS6D6tpmT3ajrzdUNajSO9e+4QH MJq1Xb3Zc4kDZanpyVRsZrtbtkRiaJgCYm4DPzf5AzBiz0LgMpY/Q2cM1Lm0zAfM7aMSSj8ieGh 3ou6Ov9He5CG28Dx32MB5EUbpQb2w5WFZNvJXA0N+25uM2tS2PU0IGYjUGlDakTgp+xrWEMtrph G9kCoT78Zw2LKVVj3817dFqFAoZThsMJLAp8VrMkXVNm8ND63oNtUalPkAiuctQ3v8+j7GmFZQh UzkQqS7g+DHDoNKgBglWyOjyeyE7VtO6XYcHd0hSmQ71aUBko7Fps/8eUtx+YBXQc3ulqg5o06x 3Ull4YF+3FUoWnmY+ShoOCZtYPzjcYXGrPTqJhs9tlSLmcJM+j2Ph8Z0v8iPd2n0yZ/4KOgLxb1 EXhouUqQ32Ov9dY+PWWIavIkVaE52vDzuejOoLTrlQcztNGvAHXhnOZiD7RB09sq9qgvMupOPVG nxP6sS6oTObNmGRgruQzM44Ze2VEgniGpd/7dcCYOwwQt+dJs0EvsqlekArR+Wvx8qq0yquDPO/ UIqf7a8cHvKmXr2oBK4CX9VTCCFFyDqBoucCtzj5boJS25FeS1X/TtqVh3zcMBjCrVVd5lvKIce ZDq4TbS5z4oB6AA== X-Developer-Key: i=asmadeus@codewreck.org; a=openpgp; fpr=B894379F662089525B3FB1B9333F1F391BBBB00A Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix the following scan-build warning: net/9p/trans_virtio.c:504:3: warning: Value stored to 'in' is never read [deadcode.DeadStores] in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I'm honestly not 100% sure about this one; I'm tempted to think we could (should?) just check the return value of pack_sg_list_p to skip the in_sgs++ and setting sgs[] if it didn't process anything, but I'm not sure it should ever happen so this is probably fine as is. Just removing the assignment at least makes it clear the return value isn't used, so it's an improvement in terms of readability. Signed-off-by: Dominique Martinet Reviewed-by: Simon Horman --- net/9p/trans_virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index f3f678289423..e305071eb7b8 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -501,8 +501,8 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, if (in_pages) { sgs[out_sgs + in_sgs++] = chan->sg + out + in; - in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM, - in_pages, in_nr_pages, offs, inlen); + pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM, + in_pages, in_nr_pages, offs, inlen); } BUG_ON(out_sgs + in_sgs > ARRAY_SIZE(sgs)); From patchwork Thu Apr 27 11:23:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 13225390 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE781C77B73 for ; Thu, 27 Apr 2023 11:24:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243700AbjD0LYX (ORCPT ); Thu, 27 Apr 2023 07:24:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243722AbjD0LYL (ORCPT ); Thu, 27 Apr 2023 07:24:11 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 030E15BAD; Thu, 27 Apr 2023 04:24:05 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id BC105C020; Thu, 27 Apr 2023 13:24:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594643; bh=VVS1YZ3lnzuAyySf5gWDB0Rab+WwhWN8PbNh//31f0g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CtsmfPTxMls0lfjs2eHidp4mceelfDQ8cVp1m7sb4NJ4IzDsZX5MPgcFW9eXixj8D ICjjLNsWhfGLYIlTTaUbC0CQXzupJJsnmy6kc3nL41mCbEx/atPyudXFjV6k14N0Og Z4XoKHzZldnjqX74DR2hckssZHOdhZgiyWKlkcHB0//hTo9dZLtMKPahpQbtZYcId5 Xe33144qtbmzhrQzlIJr7LJurl1LN4WkI9MhszRWnJeltZPWEx74uEm/lL9Hrbmkzd QFGX5Gg7MdZF3zRh3Xo6lKzFXZurbEeoYIdVTz4gftT/VumFQ5iZrQO8Za8OvgkYbX yLRtq+IBc6/LA== Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 0E7AEC026; Thu, 27 Apr 2023 13:23:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1682594641; bh=VVS1YZ3lnzuAyySf5gWDB0Rab+WwhWN8PbNh//31f0g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=4CokYUY7IMwOZBp27NEZoKnu7Rj1KEV7/pOPuZcDzKO1MWJLPVuR6sZHWNENSyMNy S2BaK7ngC+yYM9qhzpJTvoJQZF3CU2td8TBzD48r7pgWJ+EaC6+V53xinvNbSM2c/v VenQih2h3DbnrHs0cJsbSBAAqOZyNv4plA2U5jee8u2LE/NVAQvOQ7fyQvXaOtEcgT gYALiRxb4prwTlIjF6ixH9ZOOg3jVb2eq9p6ZbfoDWP+M/3xryN9IbQNKZ5+vEGqVO 40sdXLmlTzg5qaWtTO7yn2+AH5P0tx8ixhfvf3P46+HfiqSIpg0vAiU8T0AjGBdgl6 LJxbxrZiLmdVQ== Received: from [127.0.0.2] (localhost [::1]) by odin.codewreck.org (OpenSMTPD) with ESMTP id afb9a43f; Thu, 27 Apr 2023 11:23:38 +0000 (UTC) From: Dominique Martinet Date: Thu, 27 Apr 2023 20:23:38 +0900 Subject: [PATCH 5/5] 9p: remove dead stores (variable set again without being read) MIME-Version: 1.0 Message-Id: <20230427-scan-build-v1-5-efa05d65e2da@codewreck.org> References: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> In-Reply-To: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org> To: Eric Van Hensbergen , Latchesar Ionkov , Christian Schoenebeck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Dominique Martinet X-Mailer: b4 0.13-dev-f371f X-Developer-Signature: v=1; a=openpgp-sha256; l=10781; i=asmadeus@codewreck.org; h=from:subject:message-id; bh=5PVts/HOf7168p90FTc+YMetgbQ4YFDf8exEzj61sDI=; b=owEBbQKS/ZANAwAIAatOm+xqmOZwAcsmYgBkSls6qfX05MxlUVkFT5J/Rimv93bwP6EYah05Z 64XCFcotw2JAjMEAAEIAB0WIQT8g9txgG5a3TOhiE6rTpvsapjmcAUCZEpbOgAKCRCrTpvsapjm cJo1EACjzD4WrtHUZ30qLcPX8/u067Mqs1R7xKuB6UxTrFEolhXYe2yuK6sSLePERjBiDfhkLmz w95yJ0QebHSNoUZG6xJ4VPpYvHQSSZQsfh+UAKwg0Rcm7p7ZsAxJFEVCYdR+oqco55OHhYNZjsB J5ogZ8+5lHpdNAQSDpWHR9tn8G7/nlrOPUAgxOINsGUz5JDeRQP3l+0v38Z6tSwOsrd88cFxfQ6 ftmkSXxS5kBnwXmeevNUhYmsFl8gMLyQ370sZ+XmLnPeZTGAsQ6pRWqDB57N7hyF8rAX/tgCvsq vuwut1mFZ4IogzHRY016p2uUKGdcDtGG9JnBZaL1SPW9/FGDLYLo7lnNF40Qbz3vAWY8fxolL9M +mucQPNqA5TWoCfAptJ5tI4tjhk1ZIfCQ8yEfDQhT+cJQsoCvT0sBGzd1GsUBh8BUmJ5m3X///a IbrOjUyWXuFE4u85xi8cVdmvbL+pFWJnMq9Yn/dcxEM8JyKsizoGbWFCajVF+R2sCKWVJiFNIV9 +EZ4+mrBbmWzshccO7W0hxr1PnpMzN/r4jY1MWQ5Ysn4CIgkEaHrSvZe6+t1r5AR7UCslrEVCq1 nGHo7aTf+9VHjFcXYgBPVmI0meBteEvCGOcuHfCZKtjhU/0sCwac7XZkhSNn4G1480Er8HVbtOV nud7NvXjhKkZ9Hw== X-Developer-Key: i=asmadeus@codewreck.org; a=openpgp; fpr=B894379F662089525B3FB1B9333F1F391BBBB00A Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The 9p code for some reason used to initialize variables outside of the declaration, e.g. instead of just initializing the variable like this: int retval = 0 We would be doing this: int retval; retval = 0; This is perfectly fine and the compiler will just optimize dead stores anyway, but scan-build seems to think this is a problem and there are many of these warnings making the output of scan-build full of such warnings: fs/9p/vfs_inode.c:916:2: warning: Value stored to 'retval' is never read [deadcode.DeadStores] retval = 0; ^ ~ I have no strong opinion here, but if we want to regularily run scan-build we should fix these just to silence the messages. I've confirmed these all are indeed ok to remove. Signed-off-by: Dominique Martinet Reviewed-by: Simon Horman --- fs/9p/vfs_inode.c | 6 ------ fs/9p/vfs_inode_dotl.c | 1 - net/9p/client.c | 46 ++++++++++++---------------------------------- 3 files changed, 12 insertions(+), 41 deletions(-) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 54dfe4f10f43..82589d1d9bbe 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -164,7 +164,6 @@ int v9fs_uflags2omode(int uflags, int extended) { int ret; - ret = 0; switch (uflags&3) { default: case O_RDONLY: @@ -604,7 +603,6 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); - err = 0; name = dentry->d_name.name; dfid = v9fs_parent_fid(dentry); if (IS_ERR(dfid)) { @@ -816,8 +814,6 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, if (!(flags & O_CREAT) || d_really_is_positive(dentry)) return finish_no_open(file, res); - err = 0; - v9ses = v9fs_inode2v9ses(dir); perm = unixmode2p9mode(v9ses, mode); p9_omode = v9fs_uflags2omode(flags, v9fs_proto_dotu(v9ses)); @@ -913,7 +909,6 @@ v9fs_vfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, return -EINVAL; p9_debug(P9_DEBUG_VFS, "\n"); - retval = 0; old_inode = d_inode(old_dentry); new_inode = d_inode(new_dentry); v9ses = v9fs_inode2v9ses(old_inode); @@ -1067,7 +1062,6 @@ static int v9fs_vfs_setattr(struct mnt_idmap *idmap, if (retval) return retval; - retval = -EPERM; v9ses = v9fs_dentry2v9ses(dentry); if (iattr->ia_valid & ATTR_FILE) { fid = iattr->ia_file->private_data; diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index f9371b5b70ea..df7023af17cf 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -367,7 +367,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, struct posix_acl *dacl = NULL, *pacl = NULL; p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); - err = 0; v9ses = v9fs_inode2v9ses(dir); omode |= S_IFDIR; diff --git a/net/9p/client.c b/net/9p/client.c index a3340268ec8d..86bbc7147fc1 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -904,7 +904,7 @@ EXPORT_SYMBOL(do_trace_9p_fid_put); static int p9_client_version(struct p9_client *c) { - int err = 0; + int err; struct p9_req_t *req; char *version = NULL; int msize; @@ -975,7 +975,6 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) struct p9_client *clnt; char *client_id; - err = 0; clnt = kmalloc(sizeof(*clnt), GFP_KERNEL); if (!clnt) return ERR_PTR(-ENOMEM); @@ -1094,7 +1093,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, const char *uname, kuid_t n_uname, const char *aname) { - int err = 0; + int err; struct p9_req_t *req; struct p9_fid *fid; struct p9_qid qid; @@ -1147,7 +1146,6 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, struct p9_req_t *req; u16 nwqids, count; - err = 0; wqids = NULL; clnt = oldfid->clnt; if (clone) { @@ -1224,7 +1222,6 @@ int p9_client_open(struct p9_fid *fid, int mode) clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> %s fid %d mode %d\n", p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode); - err = 0; if (fid->mode != -1) return -EINVAL; @@ -1262,7 +1259,7 @@ EXPORT_SYMBOL(p9_client_open); int p9_client_create_dotl(struct p9_fid *ofid, const char *name, u32 flags, u32 mode, kgid_t gid, struct p9_qid *qid) { - int err = 0; + int err; struct p9_client *clnt; struct p9_req_t *req; int iounit; @@ -1314,7 +1311,6 @@ int p9_client_fcreate(struct p9_fid *fid, const char *name, u32 perm, int mode, p9_debug(P9_DEBUG_9P, ">>> TCREATE fid %d name %s perm %d mode %d\n", fid->fid, name, perm, mode); - err = 0; clnt = fid->clnt; if (fid->mode != -1) @@ -1350,7 +1346,7 @@ EXPORT_SYMBOL(p9_client_fcreate); int p9_client_symlink(struct p9_fid *dfid, const char *name, const char *symtgt, kgid_t gid, struct p9_qid *qid) { - int err = 0; + int err; struct p9_client *clnt; struct p9_req_t *req; @@ -1402,13 +1398,12 @@ EXPORT_SYMBOL(p9_client_link); int p9_client_fsync(struct p9_fid *fid, int datasync) { - int err; + int err = 0; struct p9_client *clnt; struct p9_req_t *req; p9_debug(P9_DEBUG_9P, ">>> TFSYNC fid %d datasync:%d\n", fid->fid, datasync); - err = 0; clnt = fid->clnt; req = p9_client_rpc(clnt, P9_TFSYNC, "dd", fid->fid, datasync); @@ -1428,7 +1423,7 @@ EXPORT_SYMBOL(p9_client_fsync); int p9_client_clunk(struct p9_fid *fid) { - int err; + int err = 0; struct p9_client *clnt; struct p9_req_t *req; int retries = 0; @@ -1436,7 +1431,6 @@ int p9_client_clunk(struct p9_fid *fid) again: p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d (try %d)\n", fid->fid, retries); - err = 0; clnt = fid->clnt; req = p9_client_rpc(clnt, P9_TCLUNK, "d", fid->fid); @@ -1465,12 +1459,11 @@ EXPORT_SYMBOL(p9_client_clunk); int p9_client_remove(struct p9_fid *fid) { - int err; + int err = 0; struct p9_client *clnt; struct p9_req_t *req; p9_debug(P9_DEBUG_9P, ">>> TREMOVE fid %d\n", fid->fid); - err = 0; clnt = fid->clnt; req = p9_client_rpc(clnt, P9_TREMOVE, "d", fid->fid); @@ -1680,7 +1673,6 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) if (!ret) return ERR_PTR(-ENOMEM); - err = 0; clnt = fid->clnt; req = p9_client_rpc(clnt, P9_TSTAT, "d", fid->fid); @@ -1733,7 +1725,6 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid, if (!ret) return ERR_PTR(-ENOMEM); - err = 0; clnt = fid->clnt; req = p9_client_rpc(clnt, P9_TGETATTR, "dq", fid->fid, request_mask); @@ -1812,11 +1803,10 @@ static int p9_client_statsize(struct p9_wstat *wst, int proto_version) int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst) { - int err; + int err = 0; struct p9_req_t *req; struct p9_client *clnt; - err = 0; clnt = fid->clnt; wst->size = p9_client_statsize(wst, clnt->proto_version); p9_debug(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", @@ -1851,11 +1841,10 @@ EXPORT_SYMBOL(p9_client_wstat); int p9_client_setattr(struct p9_fid *fid, struct p9_iattr_dotl *p9attr) { - int err; + int err = 0; struct p9_req_t *req; struct p9_client *clnt; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TSETATTR fid %d\n", fid->fid); p9_debug(P9_DEBUG_9P, " valid=%x mode=%x uid=%d gid=%d size=%lld\n", @@ -1887,7 +1876,6 @@ int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb) struct p9_req_t *req; struct p9_client *clnt; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TSTATFS fid %d\n", fid->fid); @@ -1921,11 +1909,10 @@ EXPORT_SYMBOL(p9_client_statfs); int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, const char *name) { - int err; + int err = 0; struct p9_req_t *req; struct p9_client *clnt; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TRENAME fid %d newdirfid %d name %s\n", @@ -1949,11 +1936,10 @@ EXPORT_SYMBOL(p9_client_rename); int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name, struct p9_fid *newdirfid, const char *new_name) { - int err; + int err = 0; struct p9_req_t *req; struct p9_client *clnt; - err = 0; clnt = olddirfid->clnt; p9_debug(P9_DEBUG_9P, @@ -1986,7 +1972,6 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid, struct p9_client *clnt; struct p9_fid *attr_fid; - err = 0; clnt = file_fid->clnt; attr_fid = p9_fid_create(clnt); if (!attr_fid) { @@ -2027,14 +2012,13 @@ EXPORT_SYMBOL_GPL(p9_client_xattrwalk); int p9_client_xattrcreate(struct p9_fid *fid, const char *name, u64 attr_size, int flags) { - int err; + int err = 0; struct p9_req_t *req; struct p9_client *clnt; p9_debug(P9_DEBUG_9P, ">>> TXATTRCREATE fid %d name %s size %llu flag %d\n", fid->fid, name, attr_size, flags); - err = 0; clnt = fid->clnt; req = p9_client_rpc(clnt, P9_TXATTRCREATE, "dsqd", fid->fid, name, attr_size, flags); @@ -2063,7 +2047,6 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset) p9_debug(P9_DEBUG_9P, ">>> TREADDIR fid %d offset %llu count %d\n", fid->fid, offset, count); - err = 0; clnt = fid->clnt; rsize = fid->iounit; @@ -2122,7 +2105,6 @@ int p9_client_mknod_dotl(struct p9_fid *fid, const char *name, int mode, struct p9_client *clnt; struct p9_req_t *req; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TMKNOD fid %d name %s mode %d major %d minor %d\n", @@ -2153,7 +2135,6 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, const char *name, int mode, struct p9_client *clnt; struct p9_req_t *req; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TMKDIR fid %d name %s mode %d gid %d\n", fid->fid, name, mode, from_kgid(&init_user_ns, gid)); @@ -2182,7 +2163,6 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status) struct p9_client *clnt; struct p9_req_t *req; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TLOCK fid %d type %i flags %d start %lld length %lld proc_id %d client_id %s\n", @@ -2214,7 +2194,6 @@ int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *glock) struct p9_client *clnt; struct p9_req_t *req; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TGETLOCK fid %d, type %i start %lld length %lld proc_id %d client_id %s\n", @@ -2251,7 +2230,6 @@ int p9_client_readlink(struct p9_fid *fid, char **target) struct p9_client *clnt; struct p9_req_t *req; - err = 0; clnt = fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TREADLINK fid %d\n", fid->fid);