From patchwork Tue Sep 3 16:26:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 13789057 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FA2918858F; Tue, 3 Sep 2024 16:27:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725380829; cv=none; b=eLKvc+eECJb3oVId9uY82/7OBRPqMRRHpePdPZfV0gqcXDccrSnmCOGoTjjeYoErFYXyXlfnPGRzqFDZMFvSWYngFrvGHFIJ07sL3ni3zegbxn5lRcggK1YpzczTOI2H7c3ROTf9WYdUn6vISf1yYdfCykyCE86i1NUj8Ga/VgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725380829; c=relaxed/simple; bh=kBsMuv/tx+UJkJBmQ+EnOLAKa+/GmXarSFqeGUoMqWY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QeEJPCxOFqZ6yXaLGLq5yZqto51uJU14TLa3LI2psg5/nfcMU+bZIGhTTQdo9DghFmgoEPKnSw36ABRqxQ8mN6NwVyA5muOABwZXcTPoR8pBHMqwjk8H5CcMJBX2DHPwAykyJGNjgUdwUi09oAgAhvPksPmftml2vvwIbZYArms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qb9wKrSd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qb9wKrSd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64261C4CEC6; Tue, 3 Sep 2024 16:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725380829; bh=kBsMuv/tx+UJkJBmQ+EnOLAKa+/GmXarSFqeGUoMqWY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qb9wKrSd+HrLqh8SX2KzZkunSLZcQ6SH0BFTe/D9aEcqqQ+APSFnxiqnIeP2PtBCI ou5xvtb457245SbaF/3fQYN9f3BvA1QhkKNIADCPBSsr9NGeJYQ3wKfDgcK2OzHbdh LesyM/h+v53tmM+1ThnanNyM7GK0NWa2SbOYISmYDLdPthRKxQkRFtfraEfOLoOwEv L8LVVqAw/0jFxXK2HDFE+B/0It2Zf3fRaj7deNw5L+dyzHA4YN3E6fA2YzPA8093if A+jLxjhLxWup0M+Uc4fKKl2eudzytLY0HaUlx7B1KhwHEYy35n+Ubbkr2/WosS4gUc eMLKdwJVN1urg== From: Simon Horman Date: Tue, 03 Sep 2024 17:26:53 +0100 Subject: [PATCH net-next 1/2] octeontx2-af: Pass string literal as format argument of alloc_workqueue() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-octeontx2-sparse-v1-1-f190309ecb0a@kernel.org> References: <20240903-octeontx2-sparse-v1-0-f190309ecb0a@kernel.org> In-Reply-To: <20240903-octeontx2-sparse-v1-0-f190309ecb0a@kernel.org> To: Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , Hariprasad Kelam , Subbaraya Sundeep Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , netdev@vger.kernel.org, llvm@lists.linux.dev X-Mailer: b4 0.14.0 X-Patchwork-Delegate: kuba@kernel.org Recently I noticed that both gcc-14 and clang-18 report that passing a non-string literal as the format argument of alloc_workqueue() is potentially insecure. E.g. clang-18 says: .../rvu.c:2493:32: warning: format string is not a string literal (potentially insecure) [-Wformat-security] 2493 | mw->mbox_wq = alloc_workqueue(name, | ^~~~ .../rvu.c:2493:32: note: treat the string as an argument to avoid this 2493 | mw->mbox_wq = alloc_workqueue(name, | ^ | "%s", It is always the case where the contents of name is safe to pass as the format argument. That is, in my understanding, it never contains any format escape sequences. But, it seems better to be safe than sorry. And, as a bonus, compiler output becomes less verbose by addressing this issue as suggested by clang-18. Compile tested only. Signed-off-by: Simon Horman Tested-by: Geetha sowjanya --- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c index ac7ee3f3598c..1a97fb9032fa 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -2479,9 +2479,9 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, goto free_regions; } - mw->mbox_wq = alloc_workqueue(name, + mw->mbox_wq = alloc_workqueue("%s", WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM, - num); + num, name); if (!mw->mbox_wq) { err = -ENOMEM; goto unmap_regions; From patchwork Tue Sep 3 16:26:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 13789058 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36ECC18BB98; Tue, 3 Sep 2024 16:27:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725380833; cv=none; b=jOq1wwSy+B/UrwUxQwvMTrVaNQMiO0KM+8fJC6wKuAP36UARzYLuRDGIpQNQNq2lwevIcCJ5HKQifre/VlNOMFMB0KkGT7ZEvg6o0MidSxG8+uKet6dVYRh2CO87lt2n4Arb7pFBg1dFafJQd7vI7xOpy50iUGvu4rfcvczHBxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725380833; c=relaxed/simple; bh=vhaMH9nB7L0B5h8YVg4047SSaEis2Kis9LFU6jI5oVU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uutURBJgqTWAJhPmSay31ks3GM1XD0dG85quPzZ5Qg8zwIEZAPL0+LU+Nuv+zSK5xZ7WkiDt3YtyiYrtNWzVkauiQPMr5YEiV8Rk78HOzvKF7FJXSSRk7TuODxHxwQ5jUibrZ3ntn8iQzpVEO7Yz9hcETRkjkSf7EgIrXbWYOwU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KAFuA8H4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KAFuA8H4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0E29C4CECA; Tue, 3 Sep 2024 16:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725380832; bh=vhaMH9nB7L0B5h8YVg4047SSaEis2Kis9LFU6jI5oVU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KAFuA8H4UrstlOD0JoeX3mhoqbbICkQhhXaKFpMIGPKc+ol6KEp3xotXNqF6C4SU/ OXe4iqYRgCq4ZHJNKZ0gp2nxHfAeY4kVQnKHOGCYTOzbJKRuXun/OUeWyYG9xkZp51 8jLW/D4xzU63b7KsUGDCjpJmRGd7YIPu9JXbJYdYcRyksxIXSu3jHHGP6xhBZ1aKXB aEiCpzlsNvZr+vAH6csX022kDQQYD40AH/Vi9ZX137ptN2ZvuDNYZEKT0I9/ZZQPOL gI1hz8b0ZRFaUpzFqCVoFmRCuuzUoJpyvJwbuNZgU81LJkA51/sx7MUt7jpFrzLNxJ VKhaBARzWakQg== From: Simon Horman Date: Tue, 03 Sep 2024 17:26:54 +0100 Subject: [PATCH net-next 2/2] octeontx2-pf: Make iplen __be16 in otx2_sqe_add_ext() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-octeontx2-sparse-v1-2-f190309ecb0a@kernel.org> References: <20240903-octeontx2-sparse-v1-0-f190309ecb0a@kernel.org> In-Reply-To: <20240903-octeontx2-sparse-v1-0-f190309ecb0a@kernel.org> To: Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , Hariprasad Kelam , Subbaraya Sundeep Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , netdev@vger.kernel.org, llvm@lists.linux.dev X-Mailer: b4 0.14.0 X-Patchwork-Delegate: kuba@kernel.org In otx2_sqe_add_ext() iplen is used to hold a 16-bit big-endian value, but it's type is u16, indicating a host byte order integer. Address this mismatch by changing the type of iplen to __be16. Flagged by Sparse as: .../otx2_txrx.c:699:31: warning: incorrect type in assignment (different base types) .../otx2_txrx.c:699:31: expected unsigned short [usertype] iplen .../otx2_txrx.c:699:31: got restricted __be16 [usertype] .../otx2_txrx.c:701:54: warning: incorrect type in assignment (different base types) .../otx2_txrx.c:701:54: expected restricted __be16 [usertype] tot_len .../otx2_txrx.c:701:54: got unsigned short [usertype] iplen .../otx2_txrx.c:704:60: warning: incorrect type in assignment (different base types) .../otx2_txrx.c:704:60: expected restricted __be16 [usertype] payload_len .../otx2_txrx.c:704:60: got unsigned short [usertype] iplen Introduced in commit dc1a9bf2c816 ("octeontx2-pf: Add UDP segmentation offload support") No functional change intended. Compile tested only. Signed-off-by: Simon Horman Tested-by: Geetha sowjanya --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c index 3eb85949677a..933e18ba2fb2 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c @@ -687,7 +687,7 @@ static void otx2_sqe_add_ext(struct otx2_nic *pfvf, struct otx2_snd_queue *sq, } else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) { __be16 l3_proto = vlan_get_protocol(skb); struct udphdr *udph = udp_hdr(skb); - u16 iplen; + __be16 iplen; ext->lso_sb = skb_transport_offset(skb) + sizeof(struct udphdr);