From patchwork Wed Nov 1 21:26:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 117737 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1258124edm; Wed, 1 Nov 2017 14:39:09 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qv0mpICVU8Zspip8ddIM/dC74Kad4M0Fbc7/Kiezwt/qJXZ4n3jlyE/QMUJWTxllfvtRPX X-Received: by 10.99.143.88 with SMTP id r24mr1215369pgn.224.1509572349575; Wed, 01 Nov 2017 14:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509572349; cv=none; d=google.com; s=arc-20160816; b=kp5lryLN/e0xA3/tPOfeCaEFzd4p7hoUBKOCNFlxMCkoB50nwOKhQzEm8JxkejsG4z VaSc0dbbMx62wRGxv9NtGddMa7d7Y9+SusT0BVkfatAm8I9GYJzxyRKbMptW+TCgrbRa zCsQoM7suKuTX4RBYynLWMVfATnF4B8zb4XMmFE32AXsGi2HgQccbB72OHoR8y1GLubk q/IxcV9hbt8H2UspP4cwubvnWHZkhe2ZWv152KMMTelWMQzfjyT7At1JHV9AWCXltU1i eKiTwxa99HVFFqilyGSodGNTwzsSyVTeEm/3rQv1E9pfBAqKIeojOBIReTUPAjBYJV81 kgfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Xh6111EIPGO88GMobwKcvjhWvWZQG+gqfqZmc2ve5cg=; b=igqtzSx18fM6m8TE9TvB+6/hSA7xl3KWFGc8FzaeLFq0a5IpElQNSPnqOf+R0YSFrh ozzoKtV3F5AwiN1U15jX11aWEtJiTzAlOKKz5+3C10L+O7hAeQg3YbjPtIcibE3mEYgA +4UAxnCCEIpRaplf8fashG5MZ74NqxWOwhlCoSYVMnVJu9LSxRjitUmGzv/e9oRc00Tf LYMVHqAAQrMVRCDDQRVMO++Hhw8nKVaXBIucXE04iu/oUhTbilFHmqrVyussoObG+oPK 7fisqSyXaaDKGdOfYksR4cix9cshe0DUqFrECxQMFKA9PH2FCK4O8EeBU89U+7D/x3BF 7DGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az2si499023plb.81.2017.11.01.14.39.09; Wed, 01 Nov 2017 14:39:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932685AbdKAVjH (ORCPT + 9 others); Wed, 1 Nov 2017 17:39:07 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:35457 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933737AbdKAV3L (ORCPT ); Wed, 1 Nov 2017 17:29:11 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id vA1LRAl6005103; Wed, 1 Nov 2017 22:27:10 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Arnd Bergmann , Jonathan Cameron , Willy Tarreau Subject: [PATCH 3.10 121/139] staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read Date: Wed, 1 Nov 2017 22:26:46 +0100 Message-Id: <1509571624-5001-22-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1509571624-5001-1-git-send-email-w@1wt.eu> References: <1509571159-4405-1-git-send-email-w@1wt.eu> <1509571624-5001-1-git-send-email-w@1wt.eu> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 105967ad68d2eb1a041bc041f9cf96af2a653b65 upstream. gcc-7 points out an older regression: drivers/staging/iio/resolver/ad2s1210.c: In function 'ad2s1210_read_raw': drivers/staging/iio/resolver/ad2s1210.c:515:42: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context] The original code had 'unsigned short' here, but incorrectly got converted to 'bool'. This reverts the regression and uses a normal type instead. Fixes: 29148543c521 ("staging:iio:resolver:ad2s1210 minimal chan spec conversion.") Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann Signed-off-by: Jonathan Cameron Signed-off-by: Willy Tarreau --- drivers/staging/iio/resolver/ad2s1210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index 0d3356d..3c0b16f 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -477,7 +477,7 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev, long m) { struct ad2s1210_state *st = iio_priv(indio_dev); - bool negative; + u16 negative; int ret = 0; u16 pos; s16 vel; From patchwork Wed Nov 1 21:26:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 117739 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1266661edm; Wed, 1 Nov 2017 14:50:03 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Ru/73l/qv3amNTyfk/hOfWKGZD9Gef4s3oly5DoLKtINfBBRPFfXqnHwY9xRM94SKEE7S2 X-Received: by 10.99.56.19 with SMTP id f19mr1244575pga.328.1509573003195; Wed, 01 Nov 2017 14:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509573003; cv=none; d=google.com; s=arc-20160816; b=Hw+5hY86L/swDOZe7U02Z+ZUCjCYkRy+rBj+8JHzTqsNvcwKPwXdQeVOBu0BvAcGLx iT474vhcCV15KSAEFHFGBSNGf56ktCVi5vhWIXrnSVSgZODaxYpqLAjCjaJtty6F27kY cpZhXM5oqVwHXUrZLiiu9hBgzEo8/ZzE3EfoJtFVPwOB+lOLBpurrkdkLZxCIpxmyPC+ gtywzYFVYuHdxVQ+16RCvXWKTcNOvhKP+Pm7CBtCu/gXA9XWqTd94tpzjx8sC0fIcjM7 J+Xt5pdgtSFpZujXrmr1A5p0gHR+mir51a+IunWyz5xed4UN1SCs1rEuLAHwsk0OjUzn bjWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MX2o6/zaGXJEST2vE5B9dKALTDkJ9l04PBf3dyedczo=; b=GArB9kHZn4v7uJbTHpZlseYOCrv2G1ObZoHa6+zxn6IYOt2qQuldiM+AzkFaO14keI 1eYGwn2Re9J4KonAtlXC+xQ7JlQ4FWqWJ4O4CFB0CAzZ0DjjKn5h2mnLHdOoW1imXnih 5Eh457yXS195Ck2wg6dHuUCX3HM/SM4IxIGP0Fa/cM1tG7fB6WpxLWeNzz9B2vNBA5S/ Qy/xMiuarxkRPyPR0680kaTCfG9zJgemvaiaZmtTLoCBgZ+URQW5fjl9Zfh5CZDDjt4u z7nj/UgPp0qG4xluRBH8/axeeB2EG97AMVKUlWESO4ZcTto+MECQKa8d3nRxSqD+OV1j qZNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m193si1858013pfc.125.2017.11.01.14.50.02; Wed, 01 Nov 2017 14:50:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933714AbdKAVuB (ORCPT + 9 others); Wed, 1 Nov 2017 17:50:01 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:35327 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934108AbdKAV2F (ORCPT ); Wed, 1 Nov 2017 17:28:05 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id vA1LRAkc005106; Wed, 1 Nov 2017 22:27:10 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Arnd Bergmann , "David S . Miller" , Willy Tarreau Subject: [PATCH 3.10 124/139] qlge: avoid memcpy buffer overflow Date: Wed, 1 Nov 2017 22:26:49 +0100 Message-Id: <1509571624-5001-25-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1509571624-5001-1-git-send-email-w@1wt.eu> References: <1509571159-4405-1-git-send-email-w@1wt.eu> <1509571624-5001-1-git-send-email-w@1wt.eu> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit e58f95831e7468d25eb6e41f234842ecfe6f014f upstream. gcc-8.0.0 (snapshot) points out that we copy a variable-length string into a fixed length field using memcpy() with the destination length, and that ends up copying whatever follows the string: inlined from 'ql_core_dump' at drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:1106:2: drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:708:2: error: 'memcpy' reading 15 bytes from a region of size 14 [-Werror=stringop-overflow=] memcpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1); Changing it to use strncpy() will instead zero-pad the destination, which seems to be the right thing to do here. The bug is probably harmless, but it seems like a good idea to address it in stable kernels as well, if only for the purpose of building with gcc-8 without warnings. Fixes: a61f80261306 ("qlge: Add ethtool register dump function.") Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Willy Tarreau --- drivers/net/ethernet/qlogic/qlge/qlge_dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c index 10093f0..00a8058 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c @@ -724,7 +724,7 @@ static void ql_build_coredump_seg_header( seg_hdr->cookie = MPI_COREDUMP_COOKIE; seg_hdr->segNum = seg_number; seg_hdr->segSize = seg_size; - memcpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1); + strncpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1); } /* From patchwork Wed Nov 1 21:27:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 117734 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1371624qgn; Wed, 1 Nov 2017 14:28:13 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RF7o21xVaWpq90KExg7ysoz5hz0P/6jP39WczPXgr+p0GLM3mxK9X2mLImdCPXpL5rReYS X-Received: by 10.159.229.136 with SMTP id az8mr905463plb.59.1509571693120; Wed, 01 Nov 2017 14:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509571693; cv=none; d=google.com; s=arc-20160816; b=SiPSYzj7QHJmJyJmYj27WunzvEfjHpsIk1m44I17U5V0IPXT4ACz4cG5bCH3wHa3cG PyYkDovST5rs1MQ1OUwHvGnNxZaBbTwFwCk0LowLTS94FNzUTDGHW11BP6lSP/FaKFUV ihnih5J7mMqUCFV8ENDiHLkM7uNeUvpj1yLeYNoopm1HarMjzUU6m/5DspJMRp0q94GN 4/L39M53WkemF99kEqWPQ0ztxvQhQ+9wcK6H9tvs5jO55NgrdoTrKy64JXzHLkWalL/C CnlM10yRS1H+de7t8RjDS2tG85cc9TiHT0PMZKfoDDwAGz6ypS7AcepgMPL/fhl+NN9O zNMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=c+LO7zMEf6a2RU//iE4jo6CkCfz1qh6IVU/cRjlUo3s=; b=Nvwwnwo3rVS5Q/TV3bmnGm/oSLSRXCNG1riJ3Gv3Q9l46M92VrQbaA5500lmE/0Haq GcHaqHOiUWRL3qCThauwR7r0qerQWC5rxizzp0wfTiurHo6g2ZFdpl/5FdKAGk7hnvVq F145loNGHfQiBZzwwFx0FluJlLuawOFLZKgFEjTEBLWhgHRM7vTmRouy1z9jcIpVylrV liJVkIBbaD2dvHa85/NKEor527Gn+3TFcFT0SGJ/9Wj4L1EClboBRW3kR9mJqoDBujx3 DakxuVMvLlNoEnJhC7BvSMYACatMC53+djz4dbpMmUpxlBsYjBdcRh0emBmqXZ0zQRU+ dnOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j13si1767665pff.341.2017.11.01.14.28.12; Wed, 01 Nov 2017 14:28:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934131AbdKAV2K (ORCPT + 9 others); Wed, 1 Nov 2017 17:28:10 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:35332 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933712AbdKAV2J (ORCPT ); Wed, 1 Nov 2017 17:28:09 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id vA1LRC3B005117; Wed, 1 Nov 2017 22:27:12 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Arnd Bergmann , Doug Ledford , Willy Tarreau Subject: [PATCH 3.10 135/139] IB/qib: fix false-postive maybe-uninitialized warning Date: Wed, 1 Nov 2017 22:27:00 +0100 Message-Id: <1509571624-5001-36-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1509571624-5001-1-git-send-email-w@1wt.eu> References: <1509571159-4405-1-git-send-email-w@1wt.eu> <1509571624-5001-1-git-send-email-w@1wt.eu> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit f6aafac184a3e46e919769dd4faa8bf0dc436534 upstream. aarch64-linux-gcc-7 complains about code it doesn't fully understand: drivers/infiniband/hw/qib/qib_iba7322.c: In function 'qib_7322_txchk_change': include/asm-generic/bitops/non-atomic.h:105:35: error: 'shadow' may be used uninitialized in this function [-Werror=maybe-uninitialized] The code is right, and despite trying hard, I could not come up with a version that I liked better than just adding a fake initialization here to shut up the warning. Fixes: f931551bafe1 ("IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters") Signed-off-by: Arnd Bergmann Acked-by: Ira Weiny Signed-off-by: Doug Ledford Signed-off-by: Willy Tarreau --- drivers/infiniband/hw/qib/qib_iba7322.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 5f5f20f..c61f3e7 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c @@ -6670,7 +6670,7 @@ static void qib_7322_txchk_change(struct qib_devdata *dd, u32 start, unsigned long flags; while (wait) { - unsigned long shadow; + unsigned long shadow = 0; int cstart, previ = -1; /*