Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp321568rdh; Sat, 23 Sep 2023 11:54:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0zyjxeYCGgftRFfLQTYqXsMaF31ujI7GUkp4r7jRE/Lh0+Ht+B18KyugmxXoPikG/1+30 X-Received: by 2002:a05:6870:17a7:b0:1bb:4606:5be with SMTP id r39-20020a05687017a700b001bb460605bemr3624086oae.9.1695495274464; Sat, 23 Sep 2023 11:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695495274; cv=none; d=google.com; s=arc-20160816; b=c+yDr9XDGKVZvykw79yjYj/fVOqUPkzuguH7vHwLK156A6VCKrVp8dLbqe78uCpjKm RyLF51QdJmD71HM31jN8N/Azr6Kr1c69zSQ2mnKUsQibLDPtPTqhkAAcuHff0btrMtEd IZOy3ArXgXdppYNzw5gFbrTWNggDVengICYIeDbujUqZCZd5YiU23H3SW+zGu2uOAGs5 IbxZCkxMPBIj2JpzazSQG9laxokw1E8tSLAK7087j3ph/G1arWWAfVT/PHUW6JQzid60 v1jYx5mS4s+Dzgg3COKHco/qnBe4jnbEjLeI4ims62VDc3urI0InGVwMpOP4OXR576Ag jzQA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4af0s5L5Z6lpeaNy7xDQHHMdfcRSmeq7SMiOxt0i/Tk=; fh=wX+qUZQJ7AomevPWYcu96QpkP4nCUPv/j4kX4Kh50ok=; b=JDBqEkAh5r9+aLkMIFdVXV79Ia5ZvO32NwTXXDN/GlpZ01i/hGz/+nTFEJuSdrnqmP E1Dph1V+ERnNdoXVY4TcB4uwWKrB48cHPdz11UDwmpagSdHWhGb11sFvkB3B8irYC7H2 pVrxuyf7AAGDuSFT7rpJJDPcEX3KKldMAdVX0L6Id/AjP8kseMA2zXavZn5NnV6OdWRL vsETalHKRM8mEhkS7hOhIbRyL8Ov0bD0qG/hgK8tD2oZlfdYUhwtXrJBnJ2XbyxIUAle OYlZ+KDzAC839JSeyZ4HbZrdMI3dFXhuvrmb0eQ2sx+XYLHrdLOyrc/7gFAZZL26jPUS 8JpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jh2AclgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f20-20020a63f114000000b00565610b2ed5si6602002pgi.794.2023.09.23.11.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 11:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jh2AclgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5D0278108359; Sat, 23 Sep 2023 11:54:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbjIWSyb (ORCPT + 99 others); Sat, 23 Sep 2023 14:54:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjIWSyb (ORCPT ); Sat, 23 Sep 2023 14:54:31 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1D3113; Sat, 23 Sep 2023 11:54:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 208A4C433C8; Sat, 23 Sep 2023 18:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695495264; bh=sICPMG7DrfOIsbSz6O+ydsinXn38Gvmn60xRu4Htgbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jh2AclgOIt9jUjQcls244C0E2UgqwBQHanDiARy2WXJUt1epZlozfZomdLiyUC1hw yAfXl73bLDf3Zu7zdZzd0pxWZFkjEb/c7Lrnm2OlDkJwgFuXKehZyBEXs+Jlh5DBjx Eh0hC/dDbm2p/a62AJsz3JKgihST/SkOOkWSVsrtZfR1R/h9/scotpdA06Kx3SrUbY r/TRlbpfAIEA9i5yp1dDrdxX7avl6Xo8WEkQo6pBImsavX8o4H0W7tdz4uQAqmP/I7 AaDXCW0hUJbN1hQsB3rAYXm1EQCy+gdxNlznazZU3pkPX9EJMfSiqASjhEdiXChtxw atHI4eZEGYOkw== From: Leon Romanovsky To: Yishai Hadas , Jason Gunthorpe , Jack Morgenstein , Roland Dreier , Christophe JAILLET Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH] IB/mlx4: Fix the size of a buffer in add_port_entries() Date: Sat, 23 Sep 2023 21:54:16 +0300 Message-ID: <169549523606.309442.12357071231764109578.b4-ty@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <0bb1443eb47308bc9be30232cc23004c4d4cf43e.1695448530.git.christophe.jaillet@wanadoo.fr> References: <0bb1443eb47308bc9be30232cc23004c4d4cf43e.1695448530.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Sat, 23 Sep 2023 11:54:31 -0700 (PDT) On Sat, 23 Sep 2023 07:55:56 +0200, Christophe JAILLET wrote: > In order to be sure that 'buff' is never truncated, its size should be > 12, not 11. > > When building with W=1, this fixes the following warnings: > > drivers/infiniband/hw/mlx4/sysfs.c: In function ‘add_port_entries’: > drivers/infiniband/hw/mlx4/sysfs.c:268:34: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=] > 268 | sprintf(buff, "%d", i); > | ^ > drivers/infiniband/hw/mlx4/sysfs.c:268:17: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 11 > 268 | sprintf(buff, "%d", i); > | ^~~~~~~~~~~~~~~~~~~~~~ > drivers/infiniband/hw/mlx4/sysfs.c:286:34: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=] > 286 | sprintf(buff, "%d", i); > | ^ > drivers/infiniband/hw/mlx4/sysfs.c:286:17: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 11 > 286 | sprintf(buff, "%d", i); > | ^~~~~~~~~~~~~~~~~~~~~~ > > [...] Applied, thanks! [1/1] IB/mlx4: Fix the size of a buffer in add_port_entries() https://git.kernel.org/rdma/rdma/c/d7f393430a17c2 Best regards, -- Leon Romanovsky