Message ID | 20170714120720.906842-4-arnd@arndb.de |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp888277obm; Fri, 14 Jul 2017 05:10:01 -0700 (PDT) X-Received: by 10.99.54.205 with SMTP id d196mr14538880pga.79.1500034201190; Fri, 14 Jul 2017 05:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500034201; cv=none; d=google.com; s=arc-20160816; b=mPD7exflLSpop3TGiSPe0M35Z9+Xjh00CgJUn3bhZNhd9crLx3JU+7wE0rSfIpFimm U5D/gu2nn+OAOQ8VvSqxK47x7Goyh+dWpvh4VvIGRqQdGp2XM+ecftf37aVQ8gWYYgKk RDkLemnSTxnl+jP/kIunU+TSmuKLhoGCEl3sJfkXrBxIJ04q3bk48Ae9fcW8eAg0BYZX AjQm9Kgktn2VYirOMN14yA3oD3uL09rKVNGAawk8+OCcDqmKzKm/nTFagH7gceGa4PNM qkXIypQR3Wm2BiNBT+DhwZxS3nK9GsjkqwAphaScE3TYDQNZ8wuIz5NHPvntN8exh2Du ksGQ== 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=NE8BDHpftwALD1x3PxkYDFcTP+cugxOupaha88SNNn8=; b=DM4z/42/sZETJ2nVy2MirJek2k3eKsi4cjbEvsaNKA6of3TGOxLRCO4TMDGKTJG9/T nEsrPq8N72/m3owCel4klz1yeuzV2D2WupK1+g5KXYuXyo9YqC2iOOCbM2ZKMoBZiZk1 V0MGzYrRlr5RDWgA5E37SXPSY2v1gzNWLbLBA5ftx2m0ZwypSfbIvqh2zLBSmd5wzhgJ 4dO/PYOkmIeu4bxwFcdzfo29kJ2dqDEu3T4NWrlPqiPivdiNRh26Tp7ZYYPWOillGsme 1c6lzsl/JBhldWbngGjmDWWpK8bCBX800ucsaZROXndlWnWkCA+Tssuj6cbAGGAYDNlJ xN8w== ARC-Authentication-Results: i=1; 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 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34si6873010pld.318.2017.07.14.05.10.00; Fri, 14 Jul 2017 05:10:01 -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 S1754067AbdGNMJm (ORCPT <rfc822;georgi.djakov@linaro.org> + 25 others); Fri, 14 Jul 2017 08:09:42 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:52310 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753687AbdGNMJk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Jul 2017 08:09:40 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0M731J-1dtH4f10ab-00wljm; Fri, 14 Jul 2017 14:08:08 +0200 From: Arnd Bergmann <arnd@arndb.de> To: linux-kernel@vger.kernel.org, Sathya Prakash <sathya.prakash@broadcom.com>, Chaitra P B <chaitra.basappa@broadcom.com>, Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>, "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, Guenter Roeck <linux@roeck-us.net>, akpm@linux-foundation.org, netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>, linux-scsi@vger.kernel.org, x86@kernel.org, Arnd Bergmann <arnd@arndb.de>, Hannes Reinecke <hare@suse.de>, Calvin Owens <calvinowens@fb.com>, Adam Manzanares <adam.manzanares@wdc.com>, Bart Van Assche <bart.vanassche@sandisk.com>, James Bottomley <James.Bottomley@HansenPartnership.com>, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH 03/22] scsi: mpt3sas: fix format overflow warning Date: Fri, 14 Jul 2017 14:06:55 +0200 Message-Id: <20170714120720.906842-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714120720.906842-1-arnd@arndb.de> References: <20170714120720.906842-1-arnd@arndb.de> X-Provags-ID: V03:K0:ZAl+axRAaNJy5r7jWMOo3X6azDOyn9oP0ojg5+2IN0QdCyjmrZi 9LsQ9fB1s4V0DJvFSsEV470ZOxIk/tERn0bFQPXKH6rOMvgd4DEQHLNPfoMVK+Iu34qktSX iea91MwKWHJnBbQx8a+eluXFKhK1+QW0vTnSyMnzTzctZBs7MoxbyRkngzhPk98WcFdkLMT sua0XhBqtrezR8+8kOjpw== X-UI-Out-Filterresults: notjunk:1; V01:K0:wcIKB2Ug7hA=:p/7+76FywvdqHjWDNgt+Iv RE55SMrWHnQ7GGDVx5OyworTyO8i3h2MFZqPrdQmfzkekGd6FR3Vxsl5+cTSMhoUksYOPMUuY mMl3TCkzWoqFCFDgM3B8gq1CwR05cVdadZIKfVHyszWv7dEOZjBkD4PM8ISXGMnEiCM4NC8JU upKCqlQ//CKO8Q2zZR2IElSDo+0FO/l/UThTjZEyCbG9smcGHz29Ew2H+uCKUgmadYncRgSyC t1BPncqOJS2b8Yd8hUDyddxya5b8MCw4bCoGjDHTeBVt0WKUQhmkLaMvWk604v8x7LO2XUZ93 qeME5pW6DglYg/49WoGze0yljuqknfLD89c5SZSwdC85d2a4LKFT4XMjwPLCqaoPqtVLZlN0y +YMo3zV4N5tF0Brisez7EsJBm9aPNyp+H0DFUrGicO2to/o3Lw/xDts6xzrWdhzi0Aqhkx2v4 Yte0WMpZa1jukwNMfmkXDRGastU6GEcbwkpPtU1n34KLZpzeEiRL49QVFxp6n5BHw1v6L5eDQ C8jNZ7TNELJvsVJBRqLigi2e18hX9ZdAsBVJh42ZuJ1fjjg9qhNL4vvFLBSif7oVaclulccRE /OEuqSUKZFRWp88EpWyUOrY2EsQ5HW5QsUSvjJcZeLciiiJw/StyQubN47FWTEBAV3Ll2T8kn jPsZZNjOB9AAtbhr0JYv+h30I0qyXOyxbPvQqTRmrZPQgOkoqUNyOnzKT83qEZifjmc1bi1wQ X886o19/dBlG0g2Bk2DQ7lcV4W9Dag+PrDwEDQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
gcc-7 -Wformat-* warnings
|
expand
|
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 099ab4ca7edf..a77bb7dc12b1 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -970,7 +970,7 @@ struct MPT3SAS_ADAPTER { u8 id; int cpu_count; char name[MPT_NAME_LENGTH]; - char driver_name[MPT_NAME_LENGTH]; + char driver_name[MPT_NAME_LENGTH - 8]; char tmp_string[MPT_STRING_LENGTH]; struct pci_dev *pdev; Mpi2SystemInterfaceRegs_t __iomem *chip;
We print the driver name into one string and then add and ID and copy it into a second string of the same length, at which point gcc complains about a possible overflow: drivers/scsi/mpt3sas/mpt3sas_scsih.c: In function '_scsih_probe': drivers/scsi/mpt3sas/mpt3sas_scsih.c:8884:21: error: '_cm' directive writing 3 bytes into a region of size between 1 and 32 [-Werror=format-overflow=] printf(ioc->name, "%s_cm%d", ioc->driver_name, ioc->id); ^~~~~~~~~ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8884:21: note: directive argument in the range [0, 255] drivers/scsi/mpt3sas/mpt3sas_scsih.c:8884:2: note: 'sprintf' output between 5 and 38 bytes into a destination of size 32 sprintf(ioc->name, "%s_cm%d", ioc->driver_name, ioc->id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Making the first string shorter is sufficient to avoid the warning here, as we know it can only contain either "mpt2sas" or "mpt3sas". Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0