Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4890338rdb; Tue, 12 Dec 2023 12:09:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWnbWfeN1ZLiAD6vQImu74su4ZR9mvlw8hUUSvhB6D7zNNaSLe1TA/ns06OT5dGkHUc6SD X-Received: by 2002:aa7:888f:0:b0:6ce:609d:1951 with SMTP id z15-20020aa7888f000000b006ce609d1951mr7523348pfe.15.1702411785507; Tue, 12 Dec 2023 12:09:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702411785; cv=none; d=google.com; s=arc-20160816; b=WIx90uK3NZHDYqshcwXB95P210b00shyUP0hJWqAIK9iRdSe+E9TM/n78L+BtpAh/B tVao3jEqwX7KR6wFYwJP/GHYbo3N+lbpMVcPo61ARaCiyT073crMYPXg2AigxhCje8DY r/9hXs1ycezr3SBG5IMhyBw0ZW6m6rytbPvI6w6EYHDPn9ZqtaG/BuUszQkB+ez+QKo6 JRsBORBLptJaURAacvrGRwHAw84um2rVnRnFe0YMr0L17lxOUJcu6O7t51AXq4C7ZBHb LbXRgn6MAz+eWzTyYlNJJTiY8KmMJcjHUWbursOKSzI4VRLWcLcTty3baZElgnxG6KPy R2QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TOqGi1ws2J2/YYsgiD/HwpONPM+0k7w0AaPx2uck5fE=; fh=3cWKadWkaflzpYpCkqerRKepPQAR2AjILT0uXFmappk=; b=BBLEr01lIVbb78rh1kSTH2jJxvnq4Td8iaSmSFUtdfTMYclwM7GVeC0VCsOR/hYXSu AC9uT7d561KwhdJKfiY6RKqoEGa1pDicJrOmpVFyfmueHU0NNsraQeZEdIiEnDowYeIF qwcFRQXRS7GlWBYxTkLg0Prp9fDmsxyJk5IvXdvRwnlHjUQWy8tA5ATbOzXPZChF9hbh G/p2tV+DPDLff6IfBc04fBye2wXBafx1P6V08eFuZgfEje1i4KqLyR64HplH/2fb5tpz o0Sl26vZiA8ko4US05itC2YORpSquQoFSobk7ZCVGALip06M0wL8pR1jbkzO0VrPj6gp KdSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=YMxVs23k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id kr5-20020a056a004b4500b006ce115d5514si8205675pfb.324.2023.12.12.12.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 12:09:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=YMxVs23k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 224B48047D72; Tue, 12 Dec 2023 12:09:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377151AbjLLUJ3 (ORCPT + 99 others); Tue, 12 Dec 2023 15:09:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbjLLUJ2 (ORCPT ); Tue, 12 Dec 2023 15:09:28 -0500 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A235AF for ; Tue, 12 Dec 2023 12:09:32 -0800 (PST) Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id D94JrCWy533VXD94JrOShy; Tue, 12 Dec 2023 21:09:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702411771; bh=TOqGi1ws2J2/YYsgiD/HwpONPM+0k7w0AaPx2uck5fE=; h=From:To:Cc:Subject:Date; b=YMxVs23knBY9ZnlWmH6ePcgxEIZbk2b6W/eGnh2ywnyt0fY+CbSnZ8aK7ZsUIp2u6 MB01cuDRxlUS8Z/55Vbx7eVY7VB2V54SivYEoMO8mrTOzGWQL4YoiXUm3ZIS+jauuU 3CtPoNDS/kmKyKv7Scp9lxnjK0mgTAkGLiTioCoJCpUWbll9YTPDhx/i1tjjGelDYI x8v0+ttV1Ggie5rb2oae18QaAV0W9B4lWmcAEX44teAhjnb1RsIdxe9rxd4AyGxuke A40mZXZDsAndWMI55axPNfK3KKDaokzcFjnGrm3Uj+jjTU/XUO7xZ37Jie+9WhG59I /x3VSArbhwxUw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 12 Dec 2023 21:09:31 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: hare@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: hare@suse.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 0/2] scsi: myrb: Fix a potential string truncation Date: Tue, 12 Dec 2023 21:09:09 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 12:09:43 -0800 (PST) Patch 1/2 fixes a potential string truncation issue in rebuild_show(). It is intended to be minimal in order to ease potential backport. Patch 2/2 is a bigger patch that turns some snprintf() usage in _show functions into preferred sysfs_emit() calls. This patch overrides the changes made in 1/2. There is another warning when building with W=1: 1051 | "%u.%02u-%c-%02u", | ^~~~~~~~~~~~~~~~~ drivers/scsi/myrb.c:1050:9: note: ‘snprintf’ output between 10 and 14 bytes into a destination of size 12 but I think that it is a false positive because snprintf() in Linux does not strickly folows the standard C behavior of snprintf(). If I understand correctly Linux handles %02u when C ignores it. Christophe JAILLET (2): scsi: myrb: Fix a potential string truncation in rebuild_show() scsi: myrb: Use sysfs_emit() drivers/scsi/myrb.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) -- 2.34.1