Commit 5948ae27 authored by Jens Taprogge's avatar Jens Taprogge Committed by Greg Kroah-Hartman

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJens Taprogge <jens.taprogge@taprogge.org>
Acked-by: default avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7953e44c
...@@ -31,7 +31,8 @@ static inline const struct ipack_device_id * ...@@ -31,7 +31,8 @@ static inline const struct ipack_device_id *
ipack_match_one_device(const struct ipack_device_id *id, ipack_match_one_device(const struct ipack_device_id *id,
const struct ipack_device *device) const struct ipack_device *device)
{ {
if ((id->format == IPACK_ANY_ID || id->format == device->id_format) && if ((id->format == IPACK_ANY_FORMAT ||
id->format == device->id_format) &&
(id->vendor == IPACK_ANY_ID || id->vendor == device->id_vendor) && (id->vendor == IPACK_ANY_ID || id->vendor == device->id_vendor) &&
(id->device == IPACK_ANY_ID || id->device == device->id_device)) (id->device == IPACK_ANY_ID || id->device == device->id_device))
return id; return id;
......
...@@ -600,6 +600,7 @@ struct x86_cpu_id { ...@@ -600,6 +600,7 @@ struct x86_cpu_id {
#define X86_MODEL_ANY 0 #define X86_MODEL_ANY 0
#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
#define IPACK_ANY_FORMAT 0xff
#define IPACK_ANY_ID (~0) #define IPACK_ANY_ID (~0)
struct ipack_device_id { struct ipack_device_id {
__u8 format; /* Format version or IPACK_ANY_ID */ __u8 format; /* Format version or IPACK_ANY_ID */
......
...@@ -973,7 +973,7 @@ static int do_ipack_entry(const char *filename, ...@@ -973,7 +973,7 @@ static int do_ipack_entry(const char *filename,
id->vendor = TO_NATIVE(id->vendor); id->vendor = TO_NATIVE(id->vendor);
id->device = TO_NATIVE(id->device); id->device = TO_NATIVE(id->device);
strcpy(alias, "ipack:"); strcpy(alias, "ipack:");
ADD(alias, "f", id->format != IPACK_ANY_ID, id->format); ADD(alias, "f", id->format != IPACK_ANY_FORMAT, id->format);
ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor); ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor);
ADD(alias, "d", id->device != IPACK_ANY_ID, id->device); ADD(alias, "d", id->device != IPACK_ANY_ID, id->device);
add_wildcard(alias); add_wildcard(alias);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment