From patchwork Fri Feb 2 13:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10196649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 128A960388 for ; Fri, 2 Feb 2018 13:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 038C328E53 for ; Fri, 2 Feb 2018 13:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA63128E56; Fri, 2 Feb 2018 13:12:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57ABD28E53 for ; Fri, 2 Feb 2018 13:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751697AbeBBNMy (ORCPT ); Fri, 2 Feb 2018 08:12:54 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:52581 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751634AbeBBNMx (ORCPT ); Fri, 2 Feb 2018 08:12:53 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0M4VfU-1evzli3pD2-00ykVR; Fri, 02 Feb 2018 14:12:39 +0100 From: Arnd Bergmann To: linux-scsi@vger.kernel.org, "James E . J . Bottomley" , Johannes Thumshirn , "Martin K. Petersen" Cc: Nicolas Pitre , Andi Kleen , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings Date: Fri, 2 Feb 2018 14:12:15 +0100 Message-Id: <20180202131225.1658853-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180202131225.1658853-1-arnd@arndb.de> References: <20180202131225.1658853-1-arnd@arndb.de> X-Provags-ID: V03:K0:dz8PWAnrvHGNo9daKGFlUcYqCoVYuoWYUOMtFcbnMQBPU9c86Jo w0fkQ/pjpPOF/DX85KYhKQhESxyxv3BA2FFIvE+MAY8umP/7CPXtXXLeRyfU4VOeovpExOs NJqpUDcYA04h4QhZltCYvbUnMrSt8zh3vPI5Ery/HfzDIh0+wluegoIWQ35fPkO//Dlw7NH boKEZYnZjk+RYsHVnMmtw== X-UI-Out-Filterresults: notjunk:1; V01:K0:FhCeIQgWm3I=:tQgb50UJ3E7LBP/syMLpXp 3TktEnVx67yolLqPNlrtaUq97y2cAD7yaigo4j760XiaPMemiAz9QDMQKTsU5aapE/GMbdQZp 5LYFKf2VgjD7qT8Ol7vZpWVZA+F1cybUGeTuSI83axwgyEp8zSu8DLjkiSCUhrNeiBRyuE10v BWeWOFocvlGhnQ7XXJhmLQIW+cvhqRMcVO6DkXLHRyhzEgLLT4RL0HIvELK98MIPfwYr+OETt 6VGtstnbojD32hptGpABemxv579qmGRbE0c3a4riGl2oCooPANjcsQFEX4xRMQaO93mBcPrY+ Pz/m+IqoMnHV5pr50FiBRos/F4jyp8xsfcVdAsCJ2TMJQJEaZnx04Py0O7NlRY3WVw8hbh8+4 1vkzSrtuWEszs/5O+0wuWcEbtQaBxVBNtRR1Ss9Bkr76rfg0jdM9ER60GZ1GqbDMOh/7CJDtZ TxBUeY9mG7udsIMLtdxvvDgtYcYjYGJo1mHOwjrIuDwB9c9avNRPNEWFpH8HqMUGahd5zOy0y eSohg5Sm4EMvEIHjMSMsBocdndWyvhwcXJYcx/J9+U8kwsGGUxWOnWduIggF1/B3K0Wbjdtkn cBAWq2+zbueDLqikYAer37MDEZAko6+zPizZT0Q53mykExIqvpwthOsmao2kxFNKTOPNWuhAx ALCA7bRj6baO56SOERIJ5g66p7+wKhKYEPv7X/nKMOLUEbRXVWQagY9fZgB1a18FI6BjPG3n4 BVMHDFln6pCNO7Q6qx5vPAhunUosnvnBmvqIMA== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct fc_fdmi_attr_entry contains a variable-length string at the end, which is encoded as a one-byte array. gcc-8 notices that we copy strings into it that obviously go beyond that one byte: In function 'fc_ct_ms_fill', inlined from 'fc_elsct_send' at include/scsi/fc_encode.h:518:8: include/scsi/fc_encode.h:275:3: error: 'strncpy' writing 64 bytes into a region of size 1 overflows the destination [-Werror=stringop-overflow=] strncpy((char *)&entry->value, ^ include/scsi/fc_encode.h:287:3: error: 'strncpy' writing 64 bytes into a region of size 1 overflows the destination [-Werror=stringop-overflow=] strncpy((char *)&entry->value, ^ No idea what the right fix is. Signed-off-by: Arnd Bergmann --- include/scsi/fc/fc_ms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h index f52b921b5c70..c5614e725a0e 100644 --- a/include/scsi/fc/fc_ms.h +++ b/include/scsi/fc/fc_ms.h @@ -128,7 +128,7 @@ struct fc_fdmi_port_name { struct fc_fdmi_attr_entry { __be16 type; __be16 len; - __u8 value[1]; + __u8 value[]; } __attribute__((__packed__)); /*