Re: [PATCH v2] staging/ipack: Fix bug introduced by IPack device matching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2012-09-07 at 10:29 +0200, Jens Taprogge wrote:
> ~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@xxxxxxxxxx>
> Signed-off-by: Jens Taprogge <jens.taprogge@xxxxxxxxxxxx>
> ---
>  drivers/staging/ipack/ipack.c   |    3 ++-
>  include/linux/mod_devicetable.h |    1 +
>  scripts/mod/file2alias.c        |    2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c
> index b3736c0..659aadc 100644
> --- a/drivers/staging/ipack/ipack.c
> +++ b/drivers/staging/ipack/ipack.c
> @@ -31,7 +31,8 @@ static inline const struct ipack_device_id *
>  ipack_match_one_device(const struct ipack_device_id *id,
>  		       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->device == IPACK_ANY_ID || id->device == device->id_device))
>  		return id;
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 999c4c2..70c6a35 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -600,6 +600,7 @@ struct x86_cpu_id {
>  #define X86_MODEL_ANY  0
>  #define X86_FEATURE_ANY 0	/* Same as FPU, you can't test for that */
>  
> +#define IPACK_ANY_FORMAT 0xff
>  #define IPACK_ANY_ID (~0)
>  struct ipack_device_id {
>  	__u8  format;			/* Format version or IPACK_ANY_ID */
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 3c22bda..df4fc23 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -973,7 +973,7 @@ static int do_ipack_entry(const char *filename,
>  	id->vendor = TO_NATIVE(id->vendor);
>  	id->device = TO_NATIVE(id->device);
>  	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, "d", id->device != IPACK_ANY_ID, id->device);
>  	add_wildcard(alias);

Acked-by: Samuel Iglesias Gonsálvez <siglesias@xxxxxxxxxx>

Thanks,

Sam

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux