Skip to contentSkip to conversation

drivers/net/bonding: User strscpy() to copy device name

PATCH In review [email protected] 2 participants 5 messages Jun 6 – Jun 8

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/bonding: User strscpy() to copy device name

From: David Laight <[email protected]>

---
This is one of a group of patches that remove potentially unbounded strcpy() calls.

They are mostly replaced by strscpy() or, when strlen() has just been called, with memcpy() (usually including the '\0').

Calls with copy string literals into arrays are left unchanged. They are safe and easily detected as such.

The changes were made by getting the compiler to detect the calls and then fixing the code by hand.

Note that all the changes are only compile tested.

Some Makefiles were changed to allow files to contain strcpy(). As well as 'difficult to fix' files, this included 'show' functions as they really need to use sysfs_emit() or seq_printf().

All the patches are being sent individually to avoid very long cc lists. Apologies for the terse commit messages and likely unexpected tags. (There are about 100 patches in total.)

 drivers/net/bonding/bond_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +1 -1
index af82a3df2c5d..76ca61cad875 100644
@@ -1792,7 +1792,7 @@ static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info)
 
 static void bond_fill_ifslave(struct slave *slave, struct ifslave *info)
 {
-	strcpy(info->slave_name, slave->dev->name);
+	strscpy(info->slave_name, slave->dev->name);
 	info->link = slave->link;
 	info->state = bond_slave_state(slave);
 	info->link_failure_count = slave->link_failure_count;
Signature · 1 line
2.39.5
#2 lore raw
Quoted 5 lines · On Mon, 8 Jun 2026 13:23:11 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 1 line · On Sat, 6 Jun 2026 21:26:07 +0100 [email protected] wrote:

From: David Laight <[email protected]>

Could you be so very kind to read the automated message you received when you posted this?

Looks like I managed to send two patches for files in the same directory that contained equivalent fixes.

I think I should be able to merge the patch emails into one and send as a single V2 patch that contains both changes.

David

maintainer
#3 lore raw
Quoted 6 lines · On Mon, 8 Jun 2026 22:07:10 +0100 David Laight wrote:
Quoted 3 lines · On Mon, 8 Jun 2026 13:23:11 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 1 line · On Sat, 6 Jun 2026 21:26:07 +0100 [email protected] wrote:

From: David Laight <[email protected]>

Quoted 8 lines
Quoted 2 lines

Could you be so very kind to read the automated message you received when you posted this?

Looks like I managed to send two patches for files in the same directory that contained equivalent fixes.

I think I should be able to merge the patch emails into one and send as a single V2 patch that contains both changes.

Not what I asked you.

You seem to be following the ML yet you excreted a bunch of incorrectly formatted and likely useless patches. Read the email. Start with one or two submissions at a time.

#4 lore raw
Quoted 13 lines · On Mon, 8 Jun 2026 14:18:22 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 12 lines · On Mon, 8 Jun 2026 22:07:10 +0100 David Laight wrote:
Quoted 5 lines · On Mon, 8 Jun 2026 13:23:11 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 1 line · On Sat, 6 Jun 2026 21:26:07 +0100 [email protected] wrote:

From: David Laight <[email protected]>

Could you be so very kind to read the automated message you received when you posted this?

Looks like I managed to send two patches for files in the same directory that contained equivalent fixes.

Quoted 8 lines
Quoted 2 lines

I think I should be able to merge the patch emails into one and send as a single V2 patch that contains both changes.

Not what I asked you.

You seem to be following the ML yet you excreted a bunch of incorrectly formatted and likely useless patches. Read the email. Start with one or two submissions at a time.

I got an email containing:

It looks like you reposted this series less than 24 hours after the previous version. Please allow at least 24 hours between versions so that reviewers across all time zones have a chance to look at the previous version.

That happened because patches 0013 and 0014 (of 0089) ended up with the same subject line when I generated one patch for each affected file.

Pretty much all the patches replace strcpy() with either strscpy() or (when strlen() has already been done) memcpy().

-- David