From patchwork Thu Mar 1 15:22:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 130241 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2933942edc; Thu, 1 Mar 2018 07:24:19 -0800 (PST) X-Google-Smtp-Source: AG47ELv8OaXoxb6A3zk7RobCV65M9gpSTkfSrr3KglMWWuxK588PhX5Gh/QuYkclaIXckRTRUs8H X-Received: by 10.101.92.138 with SMTP id a10mr1837302pgt.129.1519917859612; Thu, 01 Mar 2018 07:24:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519917859; cv=none; d=google.com; s=arc-20160816; b=xPirWdJp8MSeY50F9xsGlroITilSEDRtJK80vi2xFVPOt1D+gUXiHrG8BLCTrRd8qF 2FUNzeeu5iryUVoyKP06aE1W7SDre6IJL1JkDe50M0eQ0EjVtq7PNclb0MYmFlv0WXcd lAst8sblxOt5SHpGGcuSh3awH/d5Ap7aANeECvscRdvWVYenyp1LV7iIDDQ8jeNLxGhS ZM6KRL3vpbOWhtsTyXLPJPgUan32jCDWscnS/vDsYM4E0U59N7i03LsFZ9BavbnPXKBr xGb1HuQ/RHCBiw1oJzZLRYOqSxVprZFkZzHAaYVNc5cx3a6OLBl69g5tS8ZWc4wxEMgf 4zVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=948AMW3oVPbzy0QXCc8XekovOqU9zfbVHd0OtkAdqTc=; b=0QbNN9EczbDKkCbVLSclLB1hQSAKFZ1kkOVeTnI3L+ASpe43XdZvOi7zUFIK06KOut PIbKAcrearmPLKFdfpG2A4lVgKWF10PYtrw9zAmVq729BK0aZFOaEx0j1mzQIuqcTcCX b+EoSJlybdnehh0HXi7DyzzBQBnn5GXaBURRGPa1t+5zf2pWi7YCUIIWLLyq60hPJAKR avizzwUf49lNzURmAD+AnVNVeL0UUAGWqiAekLEnk5AqtDKjIpgXETGR8iCkALbyAQ1+ d2Y1PBoF1M0fVyxeFwuyIvBXStast/7BFOeByKyVZn54YhiVLpyoftBznfi3W7jzGjKI rD5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=G+gzTh0+; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b72si3177910pfk.10.2018.03.01.07.24.19; Thu, 01 Mar 2018 07:24:19 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=G+gzTh0+; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031845AbeCAPYQ (ORCPT + 10 others); Thu, 1 Mar 2018 10:24:16 -0500 Received: from mail-bn3nam01on0094.outbound.protection.outlook.com ([104.47.33.94]:25184 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1031865AbeCAPYK (ORCPT ); Thu, 1 Mar 2018 10:24:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=948AMW3oVPbzy0QXCc8XekovOqU9zfbVHd0OtkAdqTc=; b=G+gzTh0+NOBhKjV9n2QptWH4BN1vxcnqmLLMBLIWRikhdV7yJZPIC9EsTCQ5WowUDdKZirteMYJBxh2uSV9UykMEza7BvXiqFJDCMJK9pGw1kOodiZ1nRiOZMbhvyVwhAzUfAcjUwAyqzVCRT1xVHmj/Ic/9PuLYP2UzyMwUGM8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1095.namprd21.prod.outlook.com (52.132.130.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Thu, 1 Mar 2018 15:24:06 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0567.006; Thu, 1 Mar 2018 15:24:06 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Arnd Bergmann , "David S . Miller" , Sasha Levin Subject: [added to the 4.1 stable tree] bna: avoid writing uninitialized data into hw registers Thread-Topic: [added to the 4.1 stable tree] bna: avoid writing uninitialized data into hw registers Thread-Index: AQHTsXEn5ULlCJGGxEmgQrrjYv27NQ== Date: Thu, 1 Mar 2018 15:22:47 +0000 Message-ID: <20180301152116.1486-33-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1095; 6:sRsx5PyesuIAeS/niyRS5DNX3tr9OCUpYMnutatwKEGJ4vpnptSV8x90/C9Wh0uHKFB6zt1g0uR83kjJHx3IMzjLY6DCkwI1h/kOil+HZCHT2LPR04H580TJFbPhTQjC/IattPpFy8UIb91HxHQOecGH++AnbYEUjAmN/126TYNwV887qmUCz+x+u9sGB0C8uEhm3qkZGajH0/oziG3czagG7kBpdq6UUBxgo/ofxR0Xdq+UgS9DJu5Pr9ajaWQm0qKiaqsp6KJvucOcgHZIdxtAF4b4cbkGAaJrP3b39dBzkBMTOXJifmcP8tBaqEmeHXVoItGUtXO0HaskKAv3nfZAXmhnTDSoMC1MnHM/howPjzljRBokA7ahJfHborSr; 5:SqewEgJGLvmxrSsnkILCkIzIor9hpmCMlbWcFcyJmVhURz6ykgni18un2XQZUzxLoW0LxKNsN0W3pufBmI5Hj/P46Za8hYlkFaMMKTy3/REb5RSeaDjfYzcJDzj5RLMZ6hqlzuIcUMGsbf5rUkpoUcnJzvE3NbmjwYCMLscB4qk=; 24:zL5pcD6PpNwT+WJhK7Nu9jKBO52RkcGcUVLUf6CDCWa5sri5kL0Ls57Kt3+DPf0uVtLFKlmEiRPcYS8XJpFn8OapQ5qwOQQinsLRJFELnfM=; 7:UzlvUItg7bT8KSlPEMJDa5w7FsEjeRWB6F2uQqsfIGcAIwOts+y/XYsRKCJE9EypLR5uAxIcPCr5puHL6DZC9PsP6YiK1V9fmpMJH47VeRCR0AvclnQ2kypvsZ1jTp499CAvNoaeQk2dPBK49TIfT8BvhumyBbRB21K0K5vBwJ6iYSWtq7U1k7Mo7lAY0qN8GBgoEXbK0WVfOw9cXipseBcAHQjOAS0wMvILw8LVWR1s7EjUaHdTYjZTY/3NfoIK x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b8e5aa93-dc1c-49f6-d4d6-08d57f88793e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020); SRVR:DM5PR2101MB1095; x-ms-traffictypediagnostic: DM5PR2101MB1095: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231220)(944501224)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR2101MB1095; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1095; x-forefront-prvs: 05986C03E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(376002)(396003)(39860400002)(39380400002)(189003)(199004)(26005)(3846002)(6116002)(1076002)(72206003)(110136005)(54906003)(25786009)(106356001)(5660300001)(316002)(36756003)(3280700002)(10290500003)(186003)(7736002)(478600001)(10090500001)(6346003)(2900100001)(2906002)(102836004)(86612001)(86362001)(99286004)(2950100002)(97736004)(6512007)(53936002)(6506007)(14454004)(66066001)(305945005)(22452003)(81156014)(81166006)(3660700001)(107886003)(6486002)(59450400001)(6436002)(76176011)(5250100002)(4326008)(68736007)(8676002)(8936002)(2501003)(6666003)(105586002)(22906009); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1095; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: HXv255jG5L+WOfJto2aDJ14Qg/1g/crfvSoZFsiaPnBD0HPQjd6XxlqU+ABEVz03YPCd2u9kqkggqVHqqsKTSeQFrj0E2NKy0rhMVPcfygYxuqhEqmwsYDZ9Xwa5gbDs03nSGzXIGSZKoX38O2qDMZ9353Mhy6nvE1vJb74FdY0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8e5aa93-dc1c-49f6-d4d6-08d57f88793e X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2018 15:22:47.2628 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1095 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. -- 2.14.1 =============== [ Upstream commit a5af83925363eb85d467933e3d6ec5a87001eb7c ] The latest gcc-7 snapshot warns about bfa_ioc_send_enable/bfa_ioc_send_disable writing undefined values into the hardware registers: drivers/net/ethernet/brocade/bna/bfa_ioc.c: In function 'bfa_iocpf_sm_disabling_entry': arch/arm/include/asm/io.h:109:22: error: '*((void *)&disable_req+4)' is used uninitialized in this function [-Werror=uninitialized] arch/arm/include/asm/io.h:109:22: error: '*((void *)&disable_req+8)' is used uninitialized in this function [-Werror=uninitialized] The two functions look like they should do the same thing, but only one of them initializes the time stamp and clscode field. The fact that we only get a warning for one of the two functions seems to be arbitrary, based on the inlining decisions in the compiler. To address this, I'm making both functions do the same thing: - set the clscode from the ioc structure in both - set the time stamp from ktime_get_real_seconds (which also avoids the signed-integer overflow in 2038 and extends the well-defined behavior until 2106). - zero-fill the reserved field Fixes: 8b230ed8ec96 ("bna: Brocade 10Gb Ethernet device driver") Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 68f3c13c9ef6..5be892ffdaed 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1948,13 +1948,13 @@ static void bfa_ioc_send_enable(struct bfa_ioc *ioc) { struct bfi_ioc_ctrl_req enable_req; - struct timeval tv; bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, bfa_ioc_portid(ioc)); enable_req.clscode = htons(ioc->clscode); - do_gettimeofday(&tv); - enable_req.tv_sec = ntohl(tv.tv_sec); + enable_req.rsvd = htons(0); + /* overflow in 2106 */ + enable_req.tv_sec = ntohl(ktime_get_real_seconds()); bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req)); } @@ -1965,6 +1965,10 @@ bfa_ioc_send_disable(struct bfa_ioc *ioc) bfi_h2i_set(disable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_DISABLE_REQ, bfa_ioc_portid(ioc)); + disable_req.clscode = htons(ioc->clscode); + disable_req.rsvd = htons(0); + /* overflow in 2106 */ + disable_req.tv_sec = ntohl(ktime_get_real_seconds()); bfa_ioc_mbox_send(ioc, &disable_req, sizeof(struct bfi_ioc_ctrl_req)); }