From patchwork Mon Oct 17 22:05:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101690 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp593643qge; Mon, 17 Oct 2016 15:06:29 -0700 (PDT) X-Received: by 10.66.135.6 with SMTP id po6mr33714968pab.59.1476741989134; Mon, 17 Oct 2016 15:06:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p70si15557649pfa.217.2016.10.17.15.06.26; Mon, 17 Oct 2016 15:06:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964812AbcJQWGY (ORCPT + 27 others); Mon, 17 Oct 2016 18:06:24 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:63884 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934489AbcJQWGW (ORCPT ); Mon, 17 Oct 2016 18:06:22 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0MQJq4-1cNiWl05kq-00ThbY; Tue, 18 Oct 2016 00:06:03 +0200 From: Arnd Bergmann To: Pablo Neira Ayuso , Patrick McHardy , Jozsef Kadlecsik , "David S. Miller" Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org Subject: [PATCH 01/28] [v2] netfilter: nf_tables: avoid uninitialized variable warning Date: Tue, 18 Oct 2016 00:05:30 +0200 Message-Id: <20161017220557.1688282-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> X-Provags-ID: V03:K0:kPMAsGuQ1RMudUSIisawTRiG0+l+glctJAM7rf7e6JpfpaeptRB 7KvWvwEBXq0CJ3ZrOKYqagFGpKHOf24O24U4CfWQNvipFZGxOqIatCqy5N936PXbHMmneJr RwYea1NORNTBjOs3OdlnbhsDN/LLO6d0+C4AlTbte5wpEBu2aGLjkyeKLufrQYThzcDSE72 pxJsJEuZ3IworVbiMHpsA== X-UI-Out-Filterresults: notjunk:1; V01:K0:OFI5U1tbUt8=:AFGIF+vnT3buPILj/hcVbS KbYo4Yi+BdCvcrudi1rb3YXQNnKRcv+PPpfyWov6bYIRNGoJEadATJjdSrBa6mWjsiDGqhm3l 8GysuwBxFew2Lfimp2xHBFAsnEpoQkoSyOOSRioS7Lagz/iLS4HAeT6E3RmG8hS424cArQVj0 5FtN9sb1/Zy+h7GKjdZZNh55S42bV5Ao0huOl9QUZnUXHJZiCx29XkdH4Xitj/gOnA9daNNzI h5Cgoc3uS9T+c5P2CYCPXo5bGp9D0Q3EaZhYedcFWE5ZwYLR6f55Wv8eyqK7o4n1epfxFI0cg tW8rKRuqfIdASngJJHDBTNU12z5Zeb4/nvwGDPDBSpScpyjTPYFt0FP0P0ZmBX02Sab0m+IgQ ZggAK8nW5gdURmcZaEzAlJ2AHaEyygLwFCbJrsdSXj8pdFIddqSTeNYeA5MKT0wHVcMF7Tow7 NOAO0N1Aj5CWx1uvGO1yNI1t+k27QzHmPs9xLNcauo9aAJhutSW2wv3u4sdkTKVrP+ZC332Sm 0oulgwWshFl4vPFCbJTYYAu7KDat09QHhheBGReewnzOce3KCP2tFhgsUOKoqGZELUpQ04yPD opKOROU1UE0lm4JmRr+BwEGsMRj0zP4yFLjr/Lo7DQE/k8pTPYCImNnCC/ULm3Y4nxwjyVSRS 0uDPG6GR3UJu+SLAPEEha/LHLUwaOyJjkQ3EVGLroZMO0HsjiCcuHEnic+YCxUhuUyDU= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The newly added nft_range_eval() function handles the two possible nft range operations, but as the compiler warning points out, any unexpected value would lead to the 'mismatch' variable being used without being initialized: net/netfilter/nft_range.c: In function 'nft_range_eval': net/netfilter/nft_range.c:45:5: error: 'mismatch' may be used uninitialized in this function [-Werror=maybe-uninitialized] This removes the variable in question and instead moves the condition into the switch itself, which is potentially more efficient than adding a bogus 'default' clause as in my first approach, and is nicer than using the 'uninitialized_var' macro. Fixes: 0f3cd9b36977 ("netfilter: nf_tables: add range expression") Link: http://patchwork.ozlabs.org/patch/677114/ Signed-off-by: Arnd Bergmann --- net/netfilter/nft_range.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) Cc: Pablo Neira Ayuso -- 2.9.0 diff --git a/net/netfilter/nft_range.c b/net/netfilter/nft_range.c index c6d5358..2dd80f4 100644 --- a/net/netfilter/nft_range.c +++ b/net/netfilter/nft_range.c @@ -28,22 +28,20 @@ static void nft_range_eval(const struct nft_expr *expr, const struct nft_pktinfo *pkt) { const struct nft_range_expr *priv = nft_expr_priv(expr); - bool mismatch; int d1, d2; d1 = memcmp(®s->data[priv->sreg], &priv->data_from, priv->len); d2 = memcmp(®s->data[priv->sreg], &priv->data_to, priv->len); switch (priv->op) { case NFT_RANGE_EQ: - mismatch = (d1 < 0 || d2 > 0); + if (d1 < 0 || d2 > 0) + regs->verdict.code = NFT_BREAK; break; case NFT_RANGE_NEQ: - mismatch = (d1 >= 0 && d2 <= 0); + if (d1 >= 0 && d2 <= 0) + regs->verdict.code = NFT_BREAK; break; } - - if (mismatch) - regs->verdict.code = NFT_BREAK; } static const struct nla_policy nft_range_policy[NFTA_RANGE_MAX + 1] = { From patchwork Mon Oct 17 22:05:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101689 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp594088qge; Mon, 17 Oct 2016 15:07:41 -0700 (PDT) X-Received: by 10.98.68.7 with SMTP id r7mr35546127pfa.77.1476742061608; Mon, 17 Oct 2016 15:07:41 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g196si32518268pfb.21.2016.10.17.15.07.40; Mon, 17 Oct 2016 15:07:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965434AbcJQWHi (ORCPT + 27 others); Mon, 17 Oct 2016 18:07:38 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:52302 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934489AbcJQWH3 (ORCPT ); Mon, 17 Oct 2016 18:07:29 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0La0Mr-1cfFN43zJt-00lmaT; Tue, 18 Oct 2016 00:06:32 +0200 From: Arnd Bergmann To: Boris Brezillon Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , Richard Weinberger , David Woodhouse , Brian Norris , Matthias Brugger , Jorge Ramirez-Ortiz , RogerCC Lin , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 02/28] [v2] mtd: mtk: avoid warning in mtk_ecc_encode Date: Tue, 18 Oct 2016 00:05:31 +0200 Message-Id: <20161017220557.1688282-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> X-Provags-ID: V03:K0:i2YLrPLJHAF9xQ7UpSIk5QW14dMXCPX4XENib7C85fwlxzrRbK3 KMYbn21itDYgW1mgdbNUNKyC5HZZHnVsKQxrjYSZRFwNEanTFEadudQ+eHrqrpBTGnV9+QZ XxU6SMxgivffGEsOUIb4t/6MbJT9XNouE6EZ77E6qy0dEm18coXXfD/7iTckkHQ2n+PGfn/ ASi6ahKbbYDHPpNDAXlJg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ueToa7PIf2E=:NFVEPyrfGopR3nNyPX6wig 9egVKkziPqjIqTkv3Hj0RM96htSxBuAvvRBTqxWQuuZsjW8GAjpaQQMQMKMIc/+IRBj3vjQDs pAdUY32Zdeo2CIynGnookebm87PZHKIqoMtw8jX2pulB//fyYnTcuOT0715KjLaZfv3NLm9RZ nrQjkNuijsjVAUSjvXeKGbTu4M0ddwa2Ea8bte0ancOpHJ4BwdCOWA0slueuZNz5NRlC9BqAc h3GOly2QaXZeGJM7SMCU6hLVPeYLOunCVeYi9yE99gs+4A+XpxADnSJQpeBHObm0NZreXrXc7 ErOBZAQLmhrCKz44hcbpZpav22tDtjV5Bhy/7oZyszUOTe+h6vXFS3IcFUtXlPtuGSYPues4n 5dLcXT0yCuLA7O1NGhvgN0/xcCswseQgBALmx2NBGwiW7l/nSAVh2Y2IKO0++cRZuPYnV3gMG /zPu/ZQqBxxSTlbF96L3qhqykHEjY8Al5scyvY3q1FwSFTP82vpB/Q3aUUJywEGNiDoYoeCnA OWFWLcxMyx1/sqBmCPjvR5/yvwPviGQEvyMw+7OMeVEhVoDmNEICEBpOvN8MNRUe6ZZ/cXejo SoNhqLBjI3tcdEDp/oHN6khohZuFLQIIzscP/zbzpJZAQp2UD7Piuu+WZX3s+yhTBOPFfsdh6 w1YOblaA+S9PPKXg6fPCdxlGtzz0XJ6YrLqvX656ORYazECBVAqEsGqAyhav5AAdfaow= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building with -Wmaybe-uninitialized, gcc produces a silly false positive warning for the mtk_ecc_encode function: drivers/mtd/nand/mtk_ecc.c: In function 'mtk_ecc_encode': drivers/mtd/nand/mtk_ecc.c:402:15: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized] The function for some reason contains a double byte swap on big-endian builds to get the OOB data into the correct order again, and is written in a slightly confusing way. Using a simple memcpy32_fromio() to read the data simplifies it a lot so it becomes more readable and produces no warning. However, the output might not have 32-bit alignment, so we have to use another memcpy to avoid taking alignment faults or writing beyond the end of the array. Signed-off-by: Arnd Bergmann --- v2: move temporary buffer into struct mtk_ecc instead of having it on the stack, as suggested by Boris Brezillon --- drivers/mtd/nand/mtk_ecc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) -- 2.9.0 diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c index d54f666..dbf2562 100644 --- a/drivers/mtd/nand/mtk_ecc.c +++ b/drivers/mtd/nand/mtk_ecc.c @@ -86,6 +86,8 @@ struct mtk_ecc { struct completion done; struct mutex lock; u32 sectors; + + u8 eccdata[112]; }; static inline void mtk_ecc_wait_idle(struct mtk_ecc *ecc, @@ -366,9 +368,8 @@ int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config, u8 *data, u32 bytes) { dma_addr_t addr; - u8 *p; - u32 len, i, val; - int ret = 0; + u32 len; + int ret; addr = dma_map_single(ecc->dev, data, bytes, DMA_TO_DEVICE); ret = dma_mapping_error(ecc->dev, addr); @@ -393,14 +394,12 @@ int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config, /* Program ECC bytes to OOB: per sector oob = FDM + ECC + SPARE */ len = (config->strength * ECC_PARITY_BITS + 7) >> 3; - p = data + bytes; - /* write the parity bytes generated by the ECC back to the OOB region */ - for (i = 0; i < len; i++) { - if ((i % 4) == 0) - val = readl(ecc->regs + ECC_ENCPAR(i / 4)); - p[i] = (val >> ((i % 4) * 8)) & 0xff; - } + /* write the parity bytes generated by the ECC back to temp buffer */ + __ioread32_copy(ecc->eccdata, ecc->regs + ECC_ENCPAR(0), round_up(len, 4)); + + /* copy into possibly unaligned OOB region with actual length */ + memcpy(data + bytes, ecc->eccdata, len); timeout: dma_unmap_single(ecc->dev, addr, bytes, DMA_TO_DEVICE); From patchwork Mon Oct 17 22:05:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101688 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp594149qge; Mon, 17 Oct 2016 15:07:51 -0700 (PDT) X-Received: by 10.66.190.4 with SMTP id gm4mr33994218pac.210.1476742071221; Mon, 17 Oct 2016 15:07:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d90si12736112pfj.130.2016.10.17.15.07.50; Mon, 17 Oct 2016 15:07:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965458AbcJQWHl (ORCPT + 27 others); Mon, 17 Oct 2016 18:07:41 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:60659 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964923AbcJQWHg (ORCPT ); Mon, 17 Oct 2016 18:07:36 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0MNyIR-1c38cR0mcd-007Y1T; Tue, 18 Oct 2016 00:07:08 +0200 From: Arnd Bergmann To: Doug Ledford Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , Sean Hefty , Hal Rosenstock , Matan Barak , Haggai Eran , Leon Romanovsky , Sagi Grimberg , Bart Van Assche , Alex Vesker , Guy Shapiro , linux-rdma@vger.kernel.org Subject: [PATCH 03/28] [v2] infiniband: shut up a maybe-uninitialized warning Date: Tue, 18 Oct 2016 00:05:32 +0200 Message-Id: <20161017220557.1688282-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> X-Provags-ID: V03:K0:fnuW5gstPB6PzBewaFmX9yw+3PxCWbmxprxdcz4ODnCGaou49Pm Geq3XwIZpckajGWeJlHhHGojl3y6zecehG7Ew5aTGKOlWbBKjuLP/o525epVUWPGjTFgeyG i0cRnlYfn/L9YOOOvJeV8qfjWyeuuewtNQxgin/IkiMBXDt83FbuSgkiLX9lhLYbKRZ4/t8 U6d+EtT91HQC4Y71/RRhw== X-UI-Out-Filterresults: notjunk:1; V01:K0:/beImIbhc/4=:oYZfwQmLIHo3NBtQJma9Aq AMv1IjHGK3SHNJ+tRdOwI1xEAD4JWSSgwTRnsEl1fGpbXOBmKz5ZkWjkhr39dxLYA16djG5zI FPFdPqosDB1VPD+KVO+jSWrUUtOOTN8igwUPJo7vPlR4VI40E1My8ku+Bn6By50cHqHsa0w9h qZQhcyQtY0bGToG7ioeZcJORiU2WEzlnGF/T80VdpkgBG+ZPGhxaFGDWtwGMvNNL6mV9NUmET ufq68eNoF2POI4y87UUrx4S732Cd67OUcPWd/V40c98rBmJ7WNmoV29X1V30Bhrr3w8kSI6/x gc9H+y6mnhfA55TpOYwfxfKZvL5u7gpa6KrenSl1izw+Rp/1i4O/dKYhsBAgblitGl8eYmBYq NqoxE4axbbX+VXIyNBiRFdpNeCvPYLyZjpG8zkI0jUF6kruBhgQoURUeyHtyGUQJXJP26uamN 8jQMh3j2VkMfOmUL2Ts+k5WYnnrcyx/Dzm6OA/fE+XyJlC4hA4q/F3Cbzamwk6grz9sx5aFE8 h4ZU1j7VbzafsotrXqCPYlNkvW6t1UY3zdxob1P02BljJ/NxdTs01sqpXj1WX27Bpjemz9I5x K5uYSw6eaUvvJeI5H9/cn4utl6GesZIt8cR4A95ahX50KiJdqZDIbmfrdQeC6EQnXetnhS/Ud E9wPFJQc4q0j3jUSoazi1xFKUkSSbikV+eAS7NUQ/lbxJcMRcPveW9ju6Fq7QXP8Anyk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some configurations produce this harmless warning when built with gcc -Wmaybe-uninitialized: infiniband/core/cma.c: In function 'cma_get_net_dev': infiniband/core/cma.c:1242:12: warning: 'src_addr_storage.sin_addr.s_addr' may be used uninitialized in this function [-Wmaybe-uninitialized] I previously reported this for the powerpc64 defconfig, but have now reproduced the same thing for x86 as well, using gcc-5 or higher. The code looks correct to me, and this change just rearranges it by making sure we alway initialize the entire address structure to make the warning disappear. My first approach added an initialization at the time of the declaration, which Doug commented may be too costly, so I hope this version doesn't add overhead. Link: http://arm-soc.lixom.net/buildlogs/mainline/v4.7-rc6/buildall.powerpc.ppc64_defconfig.log.passed Link: https://patchwork.kernel.org/patch/9212825/ Signed-off-by: Arnd Bergmann --- drivers/infiniband/core/cma.c | 56 ++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 27 deletions(-) -- 2.9.0 diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 36bf50e..24e0ea6 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -1094,47 +1094,47 @@ static void cma_save_ib_info(struct sockaddr *src_addr, } } -static void cma_save_ip4_info(struct sockaddr *src_addr, - struct sockaddr *dst_addr, +static void cma_save_ip4_info(struct sockaddr_in *src_addr, + struct sockaddr_in *dst_addr, struct cma_hdr *hdr, __be16 local_port) { - struct sockaddr_in *ip4; - if (src_addr) { - ip4 = (struct sockaddr_in *)src_addr; - ip4->sin_family = AF_INET; - ip4->sin_addr.s_addr = hdr->dst_addr.ip4.addr; - ip4->sin_port = local_port; + *src_addr = (struct sockaddr_in) { + .sin_family = AF_INET, + .sin_addr.s_addr = hdr->dst_addr.ip4.addr, + .sin_port = local_port, + }; } if (dst_addr) { - ip4 = (struct sockaddr_in *)dst_addr; - ip4->sin_family = AF_INET; - ip4->sin_addr.s_addr = hdr->src_addr.ip4.addr; - ip4->sin_port = hdr->port; + *dst_addr = (struct sockaddr_in) { + .sin_family = AF_INET, + .sin_addr.s_addr = hdr->src_addr.ip4.addr, + .sin_port = hdr->port, + }; } } -static void cma_save_ip6_info(struct sockaddr *src_addr, - struct sockaddr *dst_addr, +static void cma_save_ip6_info(struct sockaddr_in6 *src_addr, + struct sockaddr_in6 *dst_addr, struct cma_hdr *hdr, __be16 local_port) { - struct sockaddr_in6 *ip6; - if (src_addr) { - ip6 = (struct sockaddr_in6 *)src_addr; - ip6->sin6_family = AF_INET6; - ip6->sin6_addr = hdr->dst_addr.ip6; - ip6->sin6_port = local_port; + *src_addr = (struct sockaddr_in6) { + .sin6_family = AF_INET6, + .sin6_addr = hdr->dst_addr.ip6, + .sin6_port = local_port, + }; } if (dst_addr) { - ip6 = (struct sockaddr_in6 *)dst_addr; - ip6->sin6_family = AF_INET6; - ip6->sin6_addr = hdr->src_addr.ip6; - ip6->sin6_port = hdr->port; + *dst_addr = (struct sockaddr_in6) { + .sin6_family = AF_INET6, + .sin6_addr = hdr->src_addr.ip6, + .sin6_port = hdr->port, + }; } } @@ -1159,10 +1159,12 @@ static int cma_save_ip_info(struct sockaddr *src_addr, switch (cma_get_ip_ver(hdr)) { case 4: - cma_save_ip4_info(src_addr, dst_addr, hdr, port); + cma_save_ip4_info((struct sockaddr_in *)src_addr, + (struct sockaddr_in *)dst_addr, hdr, port); break; case 6: - cma_save_ip6_info(src_addr, dst_addr, hdr, port); + cma_save_ip6_info((struct sockaddr_in6 *)src_addr, + (struct sockaddr_in6 *)dst_addr, hdr, port); break; default: return -EAFNOSUPPORT; @@ -1309,7 +1311,7 @@ static bool validate_net_dev(struct net_device *net_dev, static struct net_device *cma_get_net_dev(struct ib_cm_event *ib_event, const struct cma_req_info *req) { - struct sockaddr_storage listen_addr_storage, src_addr_storage; + struct sockaddr_storage listen_addr_storage = {}, src_addr_storage = {}; struct sockaddr *listen_addr = (struct sockaddr *)&listen_addr_storage, *src_addr = (struct sockaddr *)&src_addr_storage; struct net_device *net_dev; From patchwork Mon Oct 17 22:42:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101662 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp604296qge; Mon, 17 Oct 2016 15:43:19 -0700 (PDT) X-Received: by 10.66.152.200 with SMTP id va8mr34216900pab.12.1476744199384; Mon, 17 Oct 2016 15:43:19 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si32472898pfi.234.2016.10.17.15.43.18; Mon, 17 Oct 2016 15:43:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934155AbcJQWnP (ORCPT + 27 others); Mon, 17 Oct 2016 18:43:15 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:56515 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932714AbcJQWnG (ORCPT ); Mon, 17 Oct 2016 18:43:06 -0400 Received: from wuerfel.localnet ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue001) with ESMTPSA (Nemesis) id 0M4NmW-1cscvK2fka-00yiTh; Tue, 18 Oct 2016 00:42:30 +0200 From: Arnd Bergmann To: Oleg Drokin Cc: Linus Torvalds , linux-kernel@vger.kernel.org, "John L . Hammond" , Jinshan Xiong , James Simmons , Andreas Dilger , Greg Kroah-Hartman , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org Subject: [PATCH 08/28 v2] staging: lustre: restore initialization of return code Date: Tue, 18 Oct 2016 00:42:27 +0200 Message-ID: <17588627.UUHMZ6jH1R@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20161017220903.1746743-2-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> <20161017220903.1746743-2-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:WIxCqH/rhQWV5phEAFKfjh1rrxiZYqk/6E0OMzbi4U55NUFeQue xCQueik7MsD8adYte4BnX3hWt4VY/APcI2NmaRBn+H0HFNlNG1jnx3IlZMT9jyGn/4YUqhn D//p4HduYibmlqMdKxZrgv00vwiaIVs5tVOM4Vyk8LEsyWgrtaqFHNxc/WWTl9T5VxW9+6b /7NjRASIeXK+2ggj3YJMQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:sb31ANLxvVw=:VYJ5ujb+qkn3gG0Jh4vYkE 7aksiPgYy4MMTKjvDrX52iKz4xroyY76SrcG4BUwZWr796PU5mwjbAOloust2CMVKnIdpqS4W MCc7nv0VAY8ZcVn7wRoVJSSKIuRn+oA9wINfhAp8HePcKIP+gSV/2Y8sXLraqmL+kqbEpWGWV UFV95114BkMo+RzMleczHGTUz/PNZ0CpvAgM7sNZrPDGU65JUa6hBzywX3Z6PER1LknOj5oIe n++FYTFOEXpA1D0O/Nx9BoNxVLKAz1Acb3YGDiR+OIaTYhLsamR/EilQF++KwKwuhW+uPbVwD Q4urRDDajUc1JxtvTMt+4+FVX8GxoUX+8182z4hJaCKjS2WmLPpWJQFEcflu0lTNKOiNIcJm3 mRowNdFXLfDFL5KC0+PdcAo5lh9rLVEwSvQXn4JoS492fy/Rs/g5kUoB7pBq6cxrE+mA9fzsf Ovuyrol8wLtwe9LouanAeguCz/6+ZEGcUZoLUOyVuPSw+1oGolNx+q2gbwVrwtkr1d3JuaqpV DWkaKOYOXazIcKneSCodTcXwnJGNF9IUKXoY/Q83YBCm7CrDeFCOJJeuhr9gscG3e4BA3ehQV orrR0zabJ9bmdOFP9V0SOPhzeMoQh7hY8vdKCPlSP4e5/epRaUpfrP9ziJ3X/WzDvlfPJ9mWH UvD+pBUvcu1hGB9KZ9o/a4PiAbioKkbCCEQAIvxDNS6tIRiHVrwX2h5hNOf/bmCiwYe1Ehei/ 48WeEE+LuV+fxf15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A recent rework dropped the initialization of the initialization of the successful return code in lov_getstripe: drivers/staging/lustre/lustre/lov/lov_pack.c: In function 'lov_getstripe': drivers/staging/lustre/lustre/lov/lov_pack.c:426:9: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/staging/lustre/lustre/lov/lov_pack.c:313:6: note: 'rc' was declared here This adds it back. Fixes: e10a431b3fd0 ("staging: lustre: lov: move LSM to LOV layer") Signed-off-by: Arnd Bergmann --- v2: fix embarrassing incorrect changelog diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 17bceadd66f8..ccc1fae35791 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -418,6 +418,8 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, ((struct lov_user_md *)lmmk)->lmm_stripe_count = lum.lmm_stripe_count; if (copy_to_user(lump, lmmk, lmm_size)) rc = -EFAULT; + else + rc = 0; out_free: kvfree(lmmk);