From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91136A0548; Wed, 15 Jun 2022 10:17:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7751340221; Wed, 15 Jun 2022 10:17:04 +0200 (CEST) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by mails.dpdk.org (Postfix) with ESMTP id 0C7EA40220; Wed, 15 Jun 2022 10:17:03 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 39BEA320014C; Wed, 15 Jun 2022 04:17:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 15 Jun 2022 04:17:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1655281020; x= 1655367420; bh=MGCnrWvwxCeeaFWGLLT7d0wadGHBiMTNpfetXPBAjMU=; b=u REMquDnisfysOAHq2SGSd0lCtt1MM7BMTbbcvSa0szJ/3WcudY5nmIYkF1ZAViXm 3g+rBBrE5fFe/Z1W9etz48P1aPHsiqfGEXLIdsgbasJeRcSl2HprpxrhtPqApyT6 4bEl1Zz8VHAxckPRtY2hS/IMS9aglk6WYR2u4m8iNH6r73uz0ZAMQGBj9S22K29I 29pyxkTDlXAWx7dFdkm5nO89kRQstXaTDrIRomJvAPL53Ftwryj1oOj+Dp2xaVTF xXisR/9bHdHIda+uUO1jAn2hcfjPb9JwMclugyx1lwFm/KVqNzJRlKl3k0+VroE/ UDKTfj/bEwPqbCRFecqZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1655281020; x= 1655367420; bh=MGCnrWvwxCeeaFWGLLT7d0wadGHBiMTNpfetXPBAjMU=; b=w 6B6wM4up4AiaRvukbvZI1OZw581BP9oeWSGsjT2DenhtlApS5HjQnuOaBXPvtZNP AfZ+EElHwVtn1O+n5I85qAliEi0uj1gYbRfmhUzk24CL/L44lGvzKsE37zuFUWH2 dBkm/h7HsR+ZmRunfxqNkS1b1q3KWxRmrYVHktqo5XWgm8TKPp23Yq8/jRTGH+U2 yreAFfG+Y8FKVOZ8IUQYmA1ntvTSlxRLzyVqdhj4Sw5LRX+OgBtNY8WWCMorBAiP mGgPQFscW1Ps5Uhul3lixHQe64NYOZ3IFi5WfhNtArbx6lZkuZO9JeoroBAb5nBB tOBilDQOCmHqYIqrYFPdQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvudcutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgrshcu ofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecuggftrf grthhtvghrnheptdejieeifeehtdffgfdvleetueeffeehueejgfeuteeftddtieekgfek udehtdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 04:16:59 -0400 (EDT) From: Thomas Monjalon To: Ali Alnubani Cc: dev@dpdk.org, michaelba@mellanox.com, stable@dpdk.org, rasland@nvidia.com, david.marchand@redhat.com, bruce.richardson@intel.com Subject: Re: [PATCH v2] net/mlx5: fix build with clang 14 Date: Wed, 15 Jun 2022 10:16:57 +0200 Message-ID: <6144105.lOV4Wx5bFT@thomas> In-Reply-To: <20220511164109.1574109-1-alialnu@nvidia.com> References: <20220511135815.1564053-1-alialnu@nvidia.com> <20220511164109.1574109-1-alialnu@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 11/05/2022 18:41, Ali Alnubani: > Use fgets instead of fscanf to resolve the following warning > reported by clang 14.0.0 in Fedora 37 (Rawhide): > > drivers/net/mlx5/linux/mlx5_ethdev_os.c:1137:52: error: > 'fscanf' may overflow; destination buffer in argument 3 has size 16, > but the corresponding specifier may require size 17 > [-Werror,-Wfortify-source] > ret = fscanf(file, "%" RTE_STR(IF_NAMESIZE) "s", port_name); Some other patches are proposing to declare the variable of size IF_NAMESIZE+1 but I think it's wrong because IF_NAMESIZE includes a terminating null byte. > Fixes: 63d1db710fbc ("net/mlx5: fix unlimited parsing of switch info") > Cc: michaelba@mellanox.com > Cc: stable@dpdk.org > > Signed-off-by: Ali Alnubani [...] > - ret = fscanf(file, "%" RTE_STR(IF_NAMESIZE) "s", port_name); > - fclose(file); > - if (ret == 1) > + if (fgets(port_name, IF_NAMESIZE, file) != NULL) > mlx5_translate_port_name(port_name, &data); > + fclose(file); Acked-by: Thomas Monjalon