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 C5173A0503 for ; Wed, 18 May 2022 11:11:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B06E400D6; Wed, 18 May 2022 11:11:13 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 06379400D6 for ; Wed, 18 May 2022 11:11:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652865072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JckApONJmw2kyT7LZ/vhM4hwoefRGWS3lflupuojyAY=; b=DVk23lATd5VTJdOPRwebdCbMJSfgRV4XdncTVlHWKzd0qUtI6566PanaO2UwIKKIesd2AU W/FQfmGdPfzpje9637U5u+e91IgX3G8y4Ks2vNz1VjMvdJXsKw7aYV4aZpaIEmgzlFvu28 j4+YaZ6d0w50RPpTXzaMxZXeTnxwhNc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-16-qq_Lrd_kPhO-mTaLEAnEwA-1; Wed, 18 May 2022 05:11:09 -0400 X-MC-Unique: qq_Lrd_kPhO-mTaLEAnEwA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CBFD5380452C; Wed, 18 May 2022 09:11:08 +0000 (UTC) Received: from fchome.home (unknown [10.40.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE9D52166B2F; Wed, 18 May 2022 09:11:05 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Matan Azrad , Viacheslav Ovsiienko , Michael Baum , Ophir Munk Subject: [PATCH] net/mlx5: fix build with clang 14 Date: Wed, 18 May 2022 11:11:00 +0200 Message-Id: <20220518091100.1182494-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org clang 14 raises the following warning: ../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); Extend port_name so that it can fit a null terminated string. Fixes: 63d1db710fbc ("net/mlx5: fix unlimited parsing of switch info") Fixes: 1256805dd54d ("net/mlx5: move Linux-specific functions") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index 8fe73f1adb..e0a22ac78f 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -1105,7 +1105,7 @@ int mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) { char ifname[IF_NAMESIZE]; - char port_name[IF_NAMESIZE]; + char port_name[IF_NAMESIZE + 1]; FILE *file; struct mlx5_switch_info data = { .master = 0, -- 2.36.1