From patchwork Fri Nov 2 15:44:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 150061 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2231214ljp; Fri, 2 Nov 2018 08:44:42 -0700 (PDT) X-Google-Smtp-Source: AJdET5c10hhBJxhRECnugKmI3dSYjiuEcMfE1syYLVTMXSPW4ksV7xpPo/3hNGP0MR3KGETKv6/D X-Received: by 2002:a17:902:7c94:: with SMTP id y20-v6mr12119775pll.218.1541173482696; Fri, 02 Nov 2018 08:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541173482; cv=none; d=google.com; s=arc-20160816; b=0NBQsAmTzWlx0Nb8+u4pPdAQ+dbu0VirDg8VUIiteYJTjpnyvOtvzY3lq0EEawgAi3 gEKF5bSgZVnS0TzZrjemtXM043CMjyfvub0JE81D4Z2vYzrsohYb5EiP3CiQ7nOjZ7tf QBnyzYZw/WLtUcUxsZYrg05s9E15TzIAYCZfJaFu9Q0ewRMK7AObIdD/DY9eJIlajHbk UMb+YLm+4yhOlziHf+BUcObVj4gpa+F8jz3xVCMvEN+ihziRCSXGQ1FwTDalWezvYfES v7cGYzklZntVuTIvEX5SxSW9/iJjjrWrKgZHev+XZ91u1SGJd8HtAcFPJXhhay4a/8WH Gg2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=a18nDceFy7BtW7YbgNIFCmY4bXfgs25U8PtTNKkiO5E=; b=hFvdRyYo9Nh216zHMnKZ3X+nRFSJG50ciIaVa1Wwqe6PMfrEGqNEH7G2u78E6ptlGY OxM2qAel0Bm727V5hPGbMFmvHQ56yi3hr22GARr6fEcYZWJBZ3YTlspRh3wBCa+/knV7 m+BYamX4WUrYfhk8A8Fmd/figcw108vGBoJbxhegeOn6+jdMxvej1jssTGbo5+26KUE4 xu3XtYOYjopTYrjFYtGkQep//yNnVqVPyk2iKxbxpnZgFBZXrPpq3pduL+TYOIZIo95F EyXm/8uPwl8keBJYrTUfv2ueOl4MZzld8wCzcuLjv9g9KQeQGAfcMdMEPPD4JdDoPZQO X6+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 o1-v6si32333804pld.218.2018.11.02.08.44.42; Fri, 02 Nov 2018 08:44:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727941AbeKCAwM (ORCPT + 1 other); Fri, 2 Nov 2018 20:52:12 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:38253 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726229AbeKCAwM (ORCPT ); Fri, 2 Nov 2018 20:52:12 -0400 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MOzCW-1ftEZT48Ds-00PJNp; Fri, 02 Nov 2018 16:44:28 +0100 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MOzCW-1ftEZT48Ds-00PJNp; Fri, 02 Nov 2018 16:44:28 +0100 From: Arnd Bergmann To: Hannes Reinecke , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , James Bottomley , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: myrs: avoid stack overflow warning Date: Fri, 2 Nov 2018 16:44:13 +0100 Message-Id: <20181102154426.1951776-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:WPT/Ueqdsels/c/3nhc/ZnCHMhQZX/E1DafZp6Cw69G3O96kz2e n3+hIZ1lqoeiv0HTHUvAkt/jS7jwkA5AeOBPswXv+lUNEfTWu3KLTz2GdmXi5axe/PIGcVb uZfKjPe40mFAULsij7NAy9MadWCLIXyZhHukGeXJWWDs2M7ALovTFuyLYzNvMkjEIilHeGM uMZPZxm8PgVVNDCJNKr/g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V01:K0:PaVVdk4xXzA=:HgKcRYpG4aNTtx05qg5jtw ABtmjGM316CNnQrY0+zosZyiaRwuTff4H8ehK8EljPyiLLJx95ZJ+6Xpz4ccDeY59xEqmGrR9 CFybR7HlP0uulWCeTHU9Rw+ORFWH9CkJsfunJbR1+b8AFYoIaI5nv2kqxsUfhUZrNoqiHOnfZ k45zX5J5c9SCng4xA3e8l4BmmpqUuREa4SOM6vjuHd9y2HPG23JJ3eJwtyUgGKtrNZkLnn2n/ jtdqu4jo+0+kLS7wbQC/SV1s4fVjPrp32m6zCWHYNPrn7wm4UZP/ql9FrYGExHYl+KfFM7XHe 0Mw9vf7E+HmOKkN53t6/0Hiso8VrGUlMHHvhL3G6eBW6QVpAbqJpilt6yhVTbpnBp03eF53Y3 mu9iZ9UbQ6G2ErVsRjo+HiQpXqTR1ego75Ot1Aj3jZq0ugq2zdxcM63zDQPhT1+m/v6P0XCO1 RPG6srb56alk2cguP3iEdvY2/NW7XanzSX7WgvSD0J0STbFJDhdiKdG4p5Tju8FKVkCiVKqeL jG532gEsdBgmUhHpJRf8E/ppiszcRN/UsQMGP2va+5NyTR2EicQobYMkXsixaETNecEfIWKbv 4P4mWcynnDXWmLftk+8pnjcKa2tZhwIN+fWA8tQsyMO5xGWsBB+ACTM3+3ZRXlHv5ZflQ9Pm5 mW3Pz6YnbzUZXyVX1FBt6T5wE5CtdzV7f4tfMbthcLjsVjgcNnd1BBEfChaLPpGMS0OqM3P54 4wZnAiIdbkw3tgXv7OuTspSjGJkpgANQR5B04NgZWAS+jxZGndtUj8Y7mgOvpg4pyi8KZc0Zd mmJdGYw Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Putting a 1024 byte data structure on the stack is generally a bad idea. On 32-bit systems, it also triggers a compile-time warning when building with -Og: drivers/scsi/myrs.c: In function 'myrs_get_ctlr_info': drivers/scsi/myrs.c:212:1: error: the frame size of 1028 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] We only really need three members of the structure, so just read them manually here instead of copying the entire structure. Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)") Signed-off-by: Arnd Bergmann --- drivers/scsi/myrs.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.18.0 Reviewed-by: Hannes Reinecke diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c index 0264a2e2bc19..b8d54ef8cf6d 100644 --- a/drivers/scsi/myrs.c +++ b/drivers/scsi/myrs.c @@ -163,9 +163,12 @@ static unsigned char myrs_get_ctlr_info(struct myrs_hba *cs) dma_addr_t ctlr_info_addr; union myrs_sgl *sgl; unsigned char status; - struct myrs_ctlr_info old; + unsigned short ldev_present, ldev_critical, ldev_offline; + + ldev_present = cs->ctlr_info->ldev_present; + ldev_critical = cs->ctlr_info->ldev_critical; + ldev_offline = cs->ctlr_info->ldev_offline; - memcpy(&old, cs->ctlr_info, sizeof(struct myrs_ctlr_info)); ctlr_info_addr = dma_map_single(&cs->pdev->dev, cs->ctlr_info, sizeof(struct myrs_ctlr_info), DMA_FROM_DEVICE); @@ -198,9 +201,9 @@ static unsigned char myrs_get_ctlr_info(struct myrs_hba *cs) cs->ctlr_info->rbld_active + cs->ctlr_info->exp_active != 0) cs->needs_update = true; - if (cs->ctlr_info->ldev_present != old.ldev_present || - cs->ctlr_info->ldev_critical != old.ldev_critical || - cs->ctlr_info->ldev_offline != old.ldev_offline) + if (cs->ctlr_info->ldev_present != ldev_present || + cs->ctlr_info->ldev_critical != ldev_critical || + cs->ctlr_info->ldev_offline != ldev_offline) shost_printk(KERN_INFO, cs->host, "Logical drive count changes (%d/%d/%d)\n", cs->ctlr_info->ldev_critical,