From patchwork Wed Mar 18 08:21:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 6036961 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E4A889F54E for ; Wed, 18 Mar 2015 08:21:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A7CF204F6 for ; Wed, 18 Mar 2015 08:21:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 470BC204EA for ; Wed, 18 Mar 2015 08:21:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755154AbbCRIVe (ORCPT ); Wed, 18 Mar 2015 04:21:34 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:29597 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754722AbbCRIVb (ORCPT ); Wed, 18 Mar 2015 04:21:31 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t2I8LMTg029679 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 18 Mar 2015 08:21:22 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t2I8LLnx023948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 18 Mar 2015 08:21:22 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t2I8LLl0013047; Wed, 18 Mar 2015 08:21:21 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Mar 2015 01:21:20 -0700 Date: Wed, 18 Mar 2015 11:21:09 +0300 From: Dan Carpenter To: "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] scsi: silence an overflow warning Message-ID: <20150318082109.GA10434@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Static checkers complain that these sprintf() calls can overflow one character. It's clear that the original author just forget to account for the NUL character. It is unlikely that we will have a billion SCSI hosts. Even if we do, when you consider alignment, then the overflow is going to happen in padding and thus the overflow is not harmful. But it costs us nothing to fix this and it silences a static checker warning. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 251598e..a5d7464 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c @@ -138,7 +138,7 @@ void scsi_proc_host_add(struct Scsi_Host *shost) { struct scsi_host_template *sht = shost->hostt; struct proc_dir_entry *p; - char name[10]; + char name[12]; if (!sht->proc_dir) return; @@ -158,7 +158,7 @@ void scsi_proc_host_add(struct Scsi_Host *shost) */ void scsi_proc_host_rm(struct Scsi_Host *shost) { - char name[10]; + char name[12]; if (!shost->hostt->proc_dir) return;