diff mbox

Modpost: fixed USB alias generation for ranges including 0x9 and 0xA

Message ID 1391796911-23456-1-git-send-email-mq@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Moskyto Matejka Feb. 7, 2014, 6:15 p.m. UTC
Commit afe2dab4f6 ("USB: add hex/bcd detection to usb modalias generation")
changed the routine that generates alias ranges. Before that change, only
digits 0-9 were supported; the commit tried to fix the case when the range
includes higher values than 0x9.

Unfortunately, the commit didn't fix the case when the range includes both
0x9 and 0xA, meaning that the final range must look like [x-9A-y] where
x <= 0x9 and y >= 0xA -- instead the [x-9A-x] range was produced.

Modprobe doesn't complain as it sees no difference between no-match and
bad-pattern results of fnmatch().

Fixing this simple bug to fix the aliases.
Also changing the hardcoded beginning of the range to uppercase as all the
other letters are also uppercase in the device version numbers.

Fortunately, this affects only the dvb-usb-dib0700 module, AFAIK.

Signed-off-by: Jan Moskyto Matejka <mq@suse.cz>
---
 scripts/mod/file2alias.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Greg Kroah-Hartman Feb. 7, 2014, 7:26 p.m. UTC | #1
On Fri, Feb 07, 2014 at 07:15:11PM +0100, Jan Moskyto Matejka wrote:
> Commit afe2dab4f6 ("USB: add hex/bcd detection to usb modalias generation")
> changed the routine that generates alias ranges. Before that change, only
> digits 0-9 were supported; the commit tried to fix the case when the range
> includes higher values than 0x9.
> 
> Unfortunately, the commit didn't fix the case when the range includes both
> 0x9 and 0xA, meaning that the final range must look like [x-9A-y] where
> x <= 0x9 and y >= 0xA -- instead the [x-9A-x] range was produced.
> 
> Modprobe doesn't complain as it sees no difference between no-match and
> bad-pattern results of fnmatch().
> 
> Fixing this simple bug to fix the aliases.
> Also changing the hardcoded beginning of the range to uppercase as all the
> other letters are also uppercase in the device version numbers.
> 
> Fortunately, this affects only the dvb-usb-dib0700 module, AFAIK.

Thanks, I'll take this through the usb tree.

Odd that it's taken years for this to show up as an issue.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 2370863..25e5cb0 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -210,8 +210,8 @@  static void do_usb_entry(void *symval,
 				range_lo < 0x9 ? "[%X-9" : "[%X",
 				range_lo);
 			sprintf(alias + strlen(alias),
-				range_hi > 0xA ? "a-%X]" : "%X]",
-				range_lo);
+				range_hi > 0xA ? "A-%X]" : "%X]",
+				range_hi);
 		}
 	}
 	if (bcdDevice_initial_digits < (sizeof(bcdDevice_lo) * 2 - 1))