2014-04-02 08:19:27

by Daeseok Youn

[permalink] [raw]
Subject: [PATCH] staging: lirc: fix NULL pointer dereference


coccicheck says:
drivers/staging/media/lirc/lirc_igorplugusb.c:226:15-21:
ERROR: ir is NULL but dereferenced.

Signed-off-by: Daeseok Youn <[email protected]>
---
drivers/staging/media/lirc/lirc_igorplugusb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c
index f508a13..0ef393b 100644
--- a/drivers/staging/media/lirc/lirc_igorplugusb.c
+++ b/drivers/staging/media/lirc/lirc_igorplugusb.c
@@ -223,8 +223,8 @@ static int unregister_from_lirc(struct igorplug *ir)
int devnum;

if (!ir) {
- dev_err(&ir->usbdev->dev,
- "%s: called with NULL device struct!\n", __func__);
+ printk(DRIVER_NAME "%s: called with NULL device struct!\n",
+ __func__);
return -EINVAL;
}

--
1.7.4.4


2014-04-02 09:13:57

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: lirc: fix NULL pointer dereference

On Wed, Apr 02, 2014 at 05:18:39PM +0900, Daeseok Youn wrote:
>
> coccicheck says:
> drivers/staging/media/lirc/lirc_igorplugusb.c:226:15-21:
> ERROR: ir is NULL but dereferenced.
>
> Signed-off-by: Daeseok Youn <[email protected]>
> ---
> drivers/staging/media/lirc/lirc_igorplugusb.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c
> index f508a13..0ef393b 100644
> --- a/drivers/staging/media/lirc/lirc_igorplugusb.c
> +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c
> @@ -223,8 +223,8 @@ static int unregister_from_lirc(struct igorplug *ir)
> int devnum;
>
> if (!ir) {
> - dev_err(&ir->usbdev->dev,
> - "%s: called with NULL device struct!\n", __func__);
> + printk(DRIVER_NAME "%s: called with NULL device struct!\n",
> + __func__);


It should be pr_err() or something. But actually "ir" can't be NULL so
just delete the whole condition.


> return -EINVAL;
> }

regards,
dan carpenter

2014-04-02 09:41:25

by Daeseok Youn

[permalink] [raw]
Subject: Re: [PATCH] staging: lirc: fix NULL pointer dereference

You are right. remove whole thing and send it again.

Thanks.
Daeseok Youn

2014-04-02 18:13 GMT+09:00 Dan Carpenter <[email protected]>:
> On Wed, Apr 02, 2014 at 05:18:39PM +0900, Daeseok Youn wrote:
>>
>> coccicheck says:
>> drivers/staging/media/lirc/lirc_igorplugusb.c:226:15-21:
>> ERROR: ir is NULL but dereferenced.
>>
>> Signed-off-by: Daeseok Youn <[email protected]>
>> ---
>> drivers/staging/media/lirc/lirc_igorplugusb.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c
>> index f508a13..0ef393b 100644
>> --- a/drivers/staging/media/lirc/lirc_igorplugusb.c
>> +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c
>> @@ -223,8 +223,8 @@ static int unregister_from_lirc(struct igorplug *ir)
>> int devnum;
>>
>> if (!ir) {
>> - dev_err(&ir->usbdev->dev,
>> - "%s: called with NULL device struct!\n", __func__);
>> + printk(DRIVER_NAME "%s: called with NULL device struct!\n",
>> + __func__);
>
>
> It should be pr_err() or something. But actually "ir" can't be NULL so
> just delete the whole condition.
>
>
>> return -EINVAL;
>> }
>
> regards,
> dan carpenter
>

2014-04-02 09:50:52

by Daeseok Youn

[permalink] [raw]
Subject: Re: [PATCH] staging: lirc: fix NULL pointer dereference

Please drop this patch.

I made a patch as Dan's comment and sent it.

Thanks.
Daeseok Youn.

2014-04-02 18:41 GMT+09:00 DaeSeok Youn <[email protected]>:
> You are right. remove whole thing and send it again.
>
> Thanks.
> Daeseok Youn
>
> 2014-04-02 18:13 GMT+09:00 Dan Carpenter <[email protected]>:
>> On Wed, Apr 02, 2014 at 05:18:39PM +0900, Daeseok Youn wrote:
>>>
>>> coccicheck says:
>>> drivers/staging/media/lirc/lirc_igorplugusb.c:226:15-21:
>>> ERROR: ir is NULL but dereferenced.
>>>
>>> Signed-off-by: Daeseok Youn <[email protected]>
>>> ---
>>> drivers/staging/media/lirc/lirc_igorplugusb.c | 4 ++--
>>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c
>>> index f508a13..0ef393b 100644
>>> --- a/drivers/staging/media/lirc/lirc_igorplugusb.c
>>> +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c
>>> @@ -223,8 +223,8 @@ static int unregister_from_lirc(struct igorplug *ir)
>>> int devnum;
>>>
>>> if (!ir) {
>>> - dev_err(&ir->usbdev->dev,
>>> - "%s: called with NULL device struct!\n", __func__);
>>> + printk(DRIVER_NAME "%s: called with NULL device struct!\n",
>>> + __func__);
>>
>>
>> It should be pr_err() or something. But actually "ir" can't be NULL so
>> just delete the whole condition.
>>
>>
>>> return -EINVAL;
>>> }
>>
>> regards,
>> dan carpenter
>>