Skip to contentSkip to conversation

makedevs: don't restrict device node paths to 40 characters

PATCH In review Andre McCurdy 2 participants 4 messages Sep 12, 2016 – Oct 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 makedevs: don't restrict device node paths to 40 characters

40 character paths work OK for device nodes in /dev but not for device nodes created in a chroot, LXC container, etc.

Since the 'path' array is already a 4k buffer, the sscanf 40 character limit seems to be a typo or historical mis-merge. Update the sscanf limit and bring the code in sync with the Buildroot version:

https://git.buildroot.net/buildroot/commit/?id=8876b6751e0bc19a3754290061808f0f8420708e

---
 meta/recipes-devtools/makedevs/makedevs/makedevs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/makedevs/makedevs/makedevs.c +1 -1
index 7471f3f..cba7681 100644
@@ -360,7 +360,7 @@ static int interpret_table_entry(char *line)
 	unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
 	unsigned long start = 0, increment = 1, count = 0;
 
-	if (0 > sscanf(line, "%40s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
+	if (0 > sscanf(line, "%4095s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
 		    &type, &mode, usr_buf, grp_buf, &major, &minor, &start,
 		    &increment, &count))
 	{
Signature · 1 line
1.9.1
#1 lore raw
Quoted 6 lines · Andre McCurdy

40 character paths work OK for device nodes in /dev but not for device nodes created in a chroot, LXC container, etc.

Quoted 6 lines

Since the 'path' array is already a 4k buffer, the sscanf 40 character limit seems to be a typo or historical mis-merge. Update the sscanf limit and bring the code in sync with the Buildroot version:

https://git.buildroot.net/buildroot/commit/?id=8876b6751e0bc19a3754290061808f0f8420708e

what is upstream worthiness of this patch ? it seems it could be a good change

Quoted 27 lines

---
meta/recipes-devtools/makedevs/makedevs/makedevs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/makedevs/makedevs/makedevs.c +1 -2
index 7471f3f..cba7681 100644
@@ -360,7 +360,7 @@ static int interpret_table_entry(char *line)
 	unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
 	unsigned long start = 0, increment = 1, count = 0;
 
-	if (0 > sscanf(line, "%40s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
+	if (0 > sscanf(line, "%4095s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
 		    &type, &mode, usr_buf, grp_buf, &major, &minor, &start,
 		    &increment, &count))
 	{
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 11 lines · Khem Raj
Quoted 11 lines · Andre McCurdy

40 character paths work OK for device nodes in /dev but not for device nodes created in a chroot, LXC container, etc.

Since the 'path' array is already a 4k buffer, the sscanf 40 character limit seems to be a typo or historical mis-merge. Update the sscanf limit and bring the code in sync with the Buildroot version:

Quoted 4 lines
Quoted 1 line

https://git.buildroot.net/buildroot/commit/?id=8876b6751e0bc19a3754290061808f0f8420708e

what is upstream worthiness of this patch ? it seems it could be a good change

Where is the upstream?

Quoted 28 lines
Quoted 27 lines

---
meta/recipes-devtools/makedevs/makedevs/makedevs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/makedevs/makedevs/makedevs.c +1 -2
index 7471f3f..cba7681 100644
@@ -360,7 +360,7 @@ static int interpret_table_entry(char *line)
      unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
      unsigned long start = 0, increment = 1, count = 0;
 
-     if (0 > sscanf(line, "%40s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
+     if (0 > sscanf(line, "%4095s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
                  &type, &mode, usr_buf, grp_buf, &major, &minor, &start,
                  &increment, &count))
      {
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 15 lines · Andre McCurdy
Quoted 11 lines · Khem Raj
Quoted 11 lines · Andre McCurdy

40 character paths work OK for device nodes in /dev but not for device nodes created in a chroot, LXC container, etc.

Since the 'path' array is already a 4k buffer, the sscanf 40 character limit seems to be a typo or historical mis-merge. Update the sscanf limit and bring the code in sync with the Buildroot version:

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

https://git.buildroot.net/buildroot/commit/?id=8876b6751e0bc19a3754290061808f0f8420708e

what is upstream worthiness of this patch ? it seems it could be a good change

Where is the upstream?

mtd-utils, but in this case it seems its a back port so we are fine.

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

---
meta/recipes-devtools/makedevs/makedevs/makedevs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/makedevs/makedevs/makedevs.c +1 -2
index 7471f3f..cba7681 100644
@@ -360,7 +360,7 @@ static int interpret_table_entry(char *line)
     unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
     unsigned long start = 0, increment = 1, count = 0;
 
-     if (0 > sscanf(line, "%40s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
+     if (0 > sscanf(line, "%4095s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
                 &type, &mode, usr_buf, grp_buf, &major, &minor, &start,
                 &increment, &count))
     {
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core