From patchwork Fri Jul 14 12:07:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9840841 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 A5614602D8 for ; Fri, 14 Jul 2017 12:16:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 995E52875A for ; Fri, 14 Jul 2017 12:16:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DB0C2877A; Fri, 14 Jul 2017 12:16:52 +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=unavailable 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 1FDEC28752 for ; Fri, 14 Jul 2017 12:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754094AbdGNMNH (ORCPT ); Fri, 14 Jul 2017 08:13:07 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:60900 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754256AbdGNMMc (ORCPT ); Fri, 14 Jul 2017 08:12:32 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0MSrBt-1d6zuO0zYr-00RmaI; Fri, 14 Jul 2017 14:11:05 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Cc: Greg Kroah-Hartman , Linus Torvalds , Guenter Roeck , akpm@linux-foundation.org, netdev@vger.kernel.org, "David S . Miller" , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, x86@kernel.org, Arnd Bergmann , Sakari Ailus , linux-media@vger.kernel.org Subject: [PATCH 14/22] [media] usbvision-i2c: fix format overflow warning Date: Fri, 14 Jul 2017 14:07:06 +0200 Message-Id: <20170714120720.906842-15-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:2XJD1jUlPzw9FKBfso5qF39QSPl71WsFcuA6LbOeeBJSW10bY0P DCHuNRZ/h/1TQR5+eS0fxzl7st9a+s6cO3MmEi2aBP6U/MzP+i0JLJLkFbSTKGUY5ZDpK8c 5EaJ6gFgKbGXEBi2p2/yARMQtwL78GeAe4vRJoUt1JJFz2sq3jae1NpkSF4HE436rWLizUn UVg6GIJaBX1tU8ZCFnNEQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:OnmJhxsmQiQ=:PkFulciumtMPaR9bQqxcA3 viKStjAgs89yynULMvF3N3eIeeanzDsEczFU8xClV98+b2rK5HULDXif9pvDmLvZSy9Qz/9xh D2B+98p2pnw+EMfz5Krg12WwQ6T0eG2QAsnf+wCTAH490FV3XOxVI8ASj1U5/7mMjWG1nVOnm lQVvEXelQSJ4q8ON9bMhQWLxM/AS1k5x5yMj2TSDFouxmN7wrJxPnzFNCPk2tYDZlUEt+ErMj fuk0gU9R6+Bt6bC7TGtjQjI+qhPm6cwGb8shNYOn+ZkQ3I6+hR5WwVB6NPT/bkDT800kcyyNX j+VPY6ojemWd8krsL1V4RIWfYYk6dY+dqfHWTZslBTAC+MWUkpZyaZQk0OIebI5PcbsKE4auF vIKbPj8j7f9dhvDhb1mcbzIT6O6T5R4ny9hrtkpOc7Rn+d/PI9W6CTnh9ntvx9mRYSnt4Ueb+ 1CpAdkHNUKPsfZwzu05TfZp6f4rrsaiAP4o7z2Lzafr4a+ewjdxflwOvjOqo1KcLfs/QUrf95 ZfoF+Y5HNtAALONwUvt9vb0EU0ARj0k4HzIdrwMf1wODePs1/4jX/IPCmiTwnkldfmH0mvakv gMKXxk0KZNR6sPQML571EPrETo7pMG7v+pXBiMjbX0nWXpEjLrFYEfw2Gyc5h5cYha0q3P565 hDCLKLxujMP5r4domarJEc4OOfb+F+f39Ag+TSpSBWX/4PYx3q0QnMoUYgMCTX+hK46IabPMD zEd8LG9JzkywIfT6+DvuMBO9qmM/oVMQB3zgow== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gcc-7 notices that we copy a fixed length string into another string of the same size, with additional characters: drivers/media/usb/usbvision/usbvision-i2c.c: In function 'usbvision_i2c_register': drivers/media/usb/usbvision/usbvision-i2c.c:190:36: error: '%d' directive writing between 1 and 11 bytes into a region of size between 0 and 47 [-Werror=format-overflow=] sprintf(usbvision->i2c_adap.name, "%s-%d-%s", i2c_adap_template.name, ^~~~~~~~~~ drivers/media/usb/usbvision/usbvision-i2c.c:190:2: note: 'sprintf' output between 4 and 76 bytes into a destination of size 48 We know this is fine as the template name is always "usbvision", so we can easily avoid the warning by using this as the format string directly. Signed-off-by: Arnd Bergmann --- drivers/media/usb/usbvision/usbvision-i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/usbvision/usbvision-i2c.c b/drivers/media/usb/usbvision/usbvision-i2c.c index fdf6b6e285da..aae9f69884da 100644 --- a/drivers/media/usb/usbvision/usbvision-i2c.c +++ b/drivers/media/usb/usbvision/usbvision-i2c.c @@ -187,8 +187,8 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) usbvision->i2c_adap = i2c_adap_template; - sprintf(usbvision->i2c_adap.name, "%s-%d-%s", i2c_adap_template.name, - usbvision->dev->bus->busnum, usbvision->dev->devpath); + sprintf(usbvision->i2c_adap.name, "usbvision-%d-%s", + usbvision->dev->bus->busnum, usbvision->dev->devpath); PDEBUG(DBG_I2C, "Adaptername: %s", usbvision->i2c_adap.name); usbvision->i2c_adap.dev.parent = &usbvision->dev->dev;