aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Taprogge <jens.taprogge@taprogge.org>2012-09-07 04:29:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-07 11:27:34 -0400
commit5948ae27fb4f0e87ce8543ca1934599b83929a3e (patch)
treed7d8e33ddc830a1b969f87d9064550024b1dd957
parent7953e44cefe1359032d1148de69b966bcd2e5233 (diff)
staging/ipack: Fix bug introduced by IPack device matching
~0 can not be casted to u8. Instead of using the IPACK_ANY_ID for the format field we introduce a new IPACK_ANY_FORMAT specifically for that field and defined as 0xff. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org> Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/ipack/ipack.c3
-rw-r--r--include/linux/mod_devicetable.h1
-rw-r--r--scripts/mod/file2alias.c2
3 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c
index b3736c0a1086..659aadcac04d 100644
--- a/drivers/staging/ipack/ipack.c
+++ b/drivers/staging/ipack/ipack.c
@@ -31,7 +31,8 @@ static inline const struct ipack_device_id *
31ipack_match_one_device(const struct ipack_device_id *id, 31ipack_match_one_device(const struct ipack_device_id *id,
32 const struct ipack_device *device) 32 const struct ipack_device *device)
33{ 33{
34 if ((id->format == IPACK_ANY_ID || id->format == device->id_format) && 34 if ((id->format == IPACK_ANY_FORMAT ||
35 id->format == device->id_format) &&
35 (id->vendor == IPACK_ANY_ID || id->vendor == device->id_vendor) && 36 (id->vendor == IPACK_ANY_ID || id->vendor == device->id_vendor) &&
36 (id->device == IPACK_ANY_ID || id->device == device->id_device)) 37 (id->device == IPACK_ANY_ID || id->device == device->id_device))
37 return id; 38 return id;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 999c4c25fbf7..70c6a359b2f4 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -600,6 +600,7 @@ struct x86_cpu_id {
600#define X86_MODEL_ANY 0 600#define X86_MODEL_ANY 0
601#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ 601#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
602 602
603#define IPACK_ANY_FORMAT 0xff
603#define IPACK_ANY_ID (~0) 604#define IPACK_ANY_ID (~0)
604struct ipack_device_id { 605struct ipack_device_id {
605 __u8 format; /* Format version or IPACK_ANY_ID */ 606 __u8 format; /* Format version or IPACK_ANY_ID */
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 3c22bda8fdf3..df4fc23dd836 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -973,7 +973,7 @@ static int do_ipack_entry(const char *filename,
973 id->vendor = TO_NATIVE(id->vendor); 973 id->vendor = TO_NATIVE(id->vendor);
974 id->device = TO_NATIVE(id->device); 974 id->device = TO_NATIVE(id->device);
975 strcpy(alias, "ipack:"); 975 strcpy(alias, "ipack:");
976 ADD(alias, "f", id->format != IPACK_ANY_ID, id->format); 976 ADD(alias, "f", id->format != IPACK_ANY_FORMAT, id->format);
977 ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor); 977 ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor);
978 ADD(alias, "d", id->device != IPACK_ANY_ID, id->device); 978 ADD(alias, "d", id->device != IPACK_ANY_ID, id->device);
979 add_wildcard(alias); 979 add_wildcard(alias);