From patchwork Wed Mar 19 19:49:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thorsten Blum X-Patchwork-Id: 14023092 X-Patchwork-Delegate: kuba@kernel.org Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 371AA2135A5 for ; Wed, 19 Mar 2025 19:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742413834; cv=none; b=oThRxNwvHic5rQ19Ds/zdgBWcJNK1/j3Vnrzk6XRWx9brysVE6YbZ/f9nzmIH4URlkSUPTnfj16QrD//to1NHaaQIyuT8PgOCjbUC8ToTCplSBrzqICMbV7E7ys4AmZVEhcOVHLraKqHgs7xHHXsXlWQH2RGMAQsV8y0sCRmJeY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742413834; c=relaxed/simple; bh=v59XltM8uQQ+KUCb53z50qzUzJuh28iAFOL+RdNCSfs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pH+iZKnMbrGn7r/kp/zpeuAv8p7HiD5RaYnDD/nIYXEQaPh2QvUKP7YZhawnIt2hfV20B3Pwx/K/X1ZwEbXGQL3J0+fTD/izqVB1m09yoN/eObog6ssbszMe1ua4IyXm9zu5RxitUUTNucTVy704vt/olkuFVWGxCins+Q58iAs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=sSWfrnvE; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="sSWfrnvE" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1742413820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=byfiCU8fvjOZ+pAiCn4TzZ0P7EaHu1Y5GqBocSeFh7E=; b=sSWfrnvEk2+rxhJK9xMy1vTfDisKz5u1r7lMzVqpPQ/S91NNiyKOvhOtPZerygChZEFufZ boN6kGj878dpMvKHT/bTmZCquNU0wk+amb9ZZ4uBkBQPDpHPFM9qUTrX7EL0KTq1BTMGfH F3Cr5F/vQwu5S6Xd9pNyMSLaamo84+8= From: Thorsten Blum To: Pablo Neira Ayuso , Jozsef Kadlecsik , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: Thorsten Blum , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments Date: Wed, 19 Mar 2025 20:49:33 +0100 Message-ID: <20250319194934.3801-1-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Patchwork-Delegate: kuba@kernel.org If the destination buffer has a fixed length, both strscpy_pad() and strscpy() automatically determine its size using sizeof() when the argument is omitted. This makes the explicit sizeof() calls unnecessary. Remove them. No functional changes intended. Signed-off-by: Thorsten Blum --- net/netfilter/x_tables.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 709840612f0d..8607852dadec 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -766,9 +766,9 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, msize += off; m->u.user.match_size = msize; - strscpy(name, match->name, sizeof(name)); + strscpy(name, match->name); module_put(match->me); - strscpy_pad(m->u.user.name, name, sizeof(m->u.user.name)); + strscpy_pad(m->u.user.name, name); *size += off; *dstptr += msize; @@ -1147,9 +1147,9 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr, tsize += off; t->u.user.target_size = tsize; - strscpy(name, target->name, sizeof(name)); + strscpy(name, target->name); module_put(target->me); - strscpy_pad(t->u.user.name, name, sizeof(t->u.user.name)); + strscpy_pad(t->u.user.name, name); *size += off; *dstptr += tsize;