All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11  7:51 ` Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11  7:51 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

If the NULL test is necessary, then the dereference should be moved below
the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/staging/otus/wwrap.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
--- a/drivers/staging/otus/wwrap.c
+++ b/drivers/staging/otus/wwrap.c
@@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
 {
     struct usbdrv_private *macp =
                container_of(work, struct usbdrv_private, kevent);
-    zdev_t *dev = macp->device;
+    zdev_t *dev;
 
     if (macp == NULL)
     {
         return;
     }
+    dev = macp->device;
 
     if (test_and_set_bit(0, (void *)&smp_kevent_Lock))
     {

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11  7:51 ` Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11  7:51 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

If the NULL test is necessary, then the dereference should be moved below
the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E = NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/staging/otus/wwrap.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
--- a/drivers/staging/otus/wwrap.c
+++ b/drivers/staging/otus/wwrap.c
@@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
 {
     struct usbdrv_private *macp                 container_of(work, struct usbdrv_private, kevent);
-    zdev_t *dev = macp->device;
+    zdev_t *dev;
 
     if (macp = NULL)
     {
         return;
     }
+    dev = macp->device;
 
     if (test_and_set_bit(0, (void *)&smp_kevent_Lock))
     {

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11  7:51 ` Julia Lawall
@ 2009-07-11  8:17   ` Jiri Slaby
  -1 siblings, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2009-07-11  8:17 UTC (permalink / raw)
  To: Julia Lawall; +Cc: gregkh, devel, linux-kernel, kernel-janitors

On 07/11/2009 09:51 AM, Julia Lawall wrote:
> diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> --- a/drivers/staging/otus/wwrap.c
> +++ b/drivers/staging/otus/wwrap.c
> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
>  {
>      struct usbdrv_private *macp =
>                 container_of(work, struct usbdrv_private, kevent);
> -    zdev_t *dev = macp->device;
> +    zdev_t *dev;
>  
>      if (macp == NULL)
>      {
>          return;
>      }

The test is rather useless here.

> +    dev = macp->device;



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11  8:17   ` Jiri Slaby
  0 siblings, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2009-07-11  8:17 UTC (permalink / raw)
  To: Julia Lawall; +Cc: gregkh, devel, linux-kernel, kernel-janitors

On 07/11/2009 09:51 AM, Julia Lawall wrote:
> diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> --- a/drivers/staging/otus/wwrap.c
> +++ b/drivers/staging/otus/wwrap.c
> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
>  {
>      struct usbdrv_private *macp >                 container_of(work, struct usbdrv_private, kevent);
> -    zdev_t *dev = macp->device;
> +    zdev_t *dev;
>  
>      if (macp = NULL)
>      {
>          return;
>      }

The test is rather useless here.

> +    dev = macp->device;



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11  8:17   ` Jiri Slaby
@ 2009-07-11  8:31     ` Julia Lawall
  -1 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11  8:31 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Jiri Slaby wrote:

> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > --- a/drivers/staging/otus/wwrap.c
> > +++ b/drivers/staging/otus/wwrap.c
> > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >  {
> >      struct usbdrv_private *macp =
> >                 container_of(work, struct usbdrv_private, kevent);
> > -    zdev_t *dev = macp->device;
> > +    zdev_t *dev;
> >  
> >      if (macp == NULL)
> >      {
> >          return;
> >      }
> 
> The test is rather useless here.

OK, I will submit a revised patch that just drops it.

thanks,
julia

> > +    dev = macp->device;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11  8:31     ` Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11  8:31 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Jiri Slaby wrote:

> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > --- a/drivers/staging/otus/wwrap.c
> > +++ b/drivers/staging/otus/wwrap.c
> > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >  {
> >      struct usbdrv_private *macp > >                 container_of(work, struct usbdrv_private, kevent);
> > -    zdev_t *dev = macp->device;
> > +    zdev_t *dev;
> >  
> >      if (macp = NULL)
> >      {
> >          return;
> >      }
> 
> The test is rather useless here.

OK, I will submit a revised patch that just drops it.

thanks,
julia

> > +    dev = macp->device;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11  8:17   ` Jiri Slaby
@ 2009-07-11 10:29     ` Jaswinder Singh Rajput
  -1 siblings, 0 replies; 24+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-11 10:17 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Julia Lawall, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > --- a/drivers/staging/otus/wwrap.c
> > +++ b/drivers/staging/otus/wwrap.c
> > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >  {
> >      struct usbdrv_private *macp =
> >                 container_of(work, struct usbdrv_private, kevent);
> > -    zdev_t *dev = macp->device;
> > +    zdev_t *dev;
> >  
> >      if (macp == NULL)
> >      {
> >          return;
> >      }
> 
> The test is rather useless here.
> 

Why useless, it should be non-null before setting to dev.

But issue is why function name like kevent() is global and who is using
it.

> > +    dev = macp->device;
> 
> 

Thanks,
--
JSR


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 10:29     ` Jaswinder Singh Rajput
  0 siblings, 0 replies; 24+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-11 10:29 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Julia Lawall, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > --- a/drivers/staging/otus/wwrap.c
> > +++ b/drivers/staging/otus/wwrap.c
> > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >  {
> >      struct usbdrv_private *macp > >                 container_of(work, struct usbdrv_private, kevent);
> > -    zdev_t *dev = macp->device;
> > +    zdev_t *dev;
> >  
> >      if (macp = NULL)
> >      {
> >          return;
> >      }
> 
> The test is rather useless here.
> 

Why useless, it should be non-null before setting to dev.

But issue is why function name like kevent() is global and who is using
it.

> > +    dev = macp->device;
> 
> 

Thanks,
--
JSR


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11 10:29     ` Jaswinder Singh Rajput
@ 2009-07-11 10:44       ` Jaswinder Singh Rajput
  -1 siblings, 0 replies; 24+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-11 10:32 UTC (permalink / raw)
  To: Jiri Slaby, Luis R. Rodriguez
  Cc: Julia Lawall, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 2009-07-11 at 15:47 +0530, Jaswinder Singh Rajput wrote:
> On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> > On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > > --- a/drivers/staging/otus/wwrap.c
> > > +++ b/drivers/staging/otus/wwrap.c
> > > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> > >  {
> > >      struct usbdrv_private *macp =
> > >                 container_of(work, struct usbdrv_private, kevent);
> > > -    zdev_t *dev = macp->device;
> > > +    zdev_t *dev;
> > >  
> > >      if (macp == NULL)
> > >      {
> > >          return;
> > >      }
> > 
> > The test is rather useless here.
> > 
> 
> Why useless, it should be non-null before setting to dev.
> 
> But issue is why function name like kevent() is global and who is using
> it.
> 
> > > +    dev = macp->device;
> > 
> > 
> 

And more funny thing is that all functions are global in this file.

Greg, can you please check the scope of these function, why all are
global.

Thanks,
--
JSR


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 10:44       ` Jaswinder Singh Rajput
  0 siblings, 0 replies; 24+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-11 10:44 UTC (permalink / raw)
  To: Jiri Slaby, Luis R. Rodriguez
  Cc: Julia Lawall, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 2009-07-11 at 15:47 +0530, Jaswinder Singh Rajput wrote:
> On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> > On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > > --- a/drivers/staging/otus/wwrap.c
> > > +++ b/drivers/staging/otus/wwrap.c
> > > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> > >  {
> > >      struct usbdrv_private *macp > > >                 container_of(work, struct usbdrv_private, kevent);
> > > -    zdev_t *dev = macp->device;
> > > +    zdev_t *dev;
> > >  
> > >      if (macp = NULL)
> > >      {
> > >          return;
> > >      }
> > 
> > The test is rather useless here.
> > 
> 
> Why useless, it should be non-null before setting to dev.
> 
> But issue is why function name like kevent() is global and who is using
> it.
> 
> > > +    dev = macp->device;
> > 
> > 
> 

And more funny thing is that all functions are global in this file.

Greg, can you please check the scope of these function, why all are
global.

Thanks,
--
JSR


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11 10:29     ` Jaswinder Singh Rajput
@ 2009-07-11 11:06       ` Jiri Slaby
  -1 siblings, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2009-07-11 11:06 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Julia Lawall, gregkh, devel, linux-kernel, kernel-janitors

On 07/11/2009 12:17 PM, Jaswinder Singh Rajput wrote:
> On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
>> On 07/11/2009 09:51 AM, Julia Lawall wrote:
>>> --- a/drivers/staging/otus/wwrap.c
>>> +++ b/drivers/staging/otus/wwrap.c
>>> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
>>>  {
>>>      struct usbdrv_private *macp =
>>>                 container_of(work, struct usbdrv_private, kevent);
>>> -    zdev_t *dev = macp->device;
>>> +    zdev_t *dev;
>>>  
>>>      if (macp == NULL)
>>>      {
>>>          return;
>>>      }
>>
>> The test is rather useless here.
>>
> 
> Why useless, it should be non-null before setting to dev.

Even if work was NULL, macp won't be NULL.

> But issue is why function name like kevent() is global and who is using
> it.

Since it's not declared, I guess nobody but keventd. It should be static.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 11:06       ` Jiri Slaby
  0 siblings, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2009-07-11 11:06 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Julia Lawall, gregkh, devel, linux-kernel, kernel-janitors

On 07/11/2009 12:17 PM, Jaswinder Singh Rajput wrote:
> On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
>> On 07/11/2009 09:51 AM, Julia Lawall wrote:
>>> --- a/drivers/staging/otus/wwrap.c
>>> +++ b/drivers/staging/otus/wwrap.c
>>> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
>>>  {
>>>      struct usbdrv_private *macp >>>                 container_of(work, struct usbdrv_private, kevent);
>>> -    zdev_t *dev = macp->device;
>>> +    zdev_t *dev;
>>>  
>>>      if (macp = NULL)
>>>      {
>>>          return;
>>>      }
>>
>> The test is rather useless here.
>>
> 
> Why useless, it should be non-null before setting to dev.

Even if work was NULL, macp won't be NULL.

> But issue is why function name like kevent() is global and who is using
> it.

Since it's not declared, I guess nobody but keventd. It should be static.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11 10:44       ` Jaswinder Singh Rajput
@ 2009-07-11 11:09         ` Jiri Slaby
  -1 siblings, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2009-07-11 11:09 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Luis R. Rodriguez, Julia Lawall, gregkh, devel, linux-kernel,
	kernel-janitors

On 07/11/2009 12:32 PM, Jaswinder Singh Rajput wrote:
> And more funny thing is that all functions are global in this file.
> 
> Greg, can you please check the scope of these function, why all are
> global.

Why don't you do that? I think patches are welcome :).

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 11:09         ` Jiri Slaby
  0 siblings, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2009-07-11 11:09 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Luis R. Rodriguez, Julia Lawall, gregkh, devel, linux-kernel,
	kernel-janitors

On 07/11/2009 12:32 PM, Jaswinder Singh Rajput wrote:
> And more funny thing is that all functions are global in this file.
> 
> Greg, can you please check the scope of these function, why all are
> global.

Why don't you do that? I think patches are welcome :).

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11 11:06       ` Jiri Slaby
@ 2009-07-11 11:32         ` Julia Lawall
  -1 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11 11:32 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Jaswinder Singh Rajput, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Jiri Slaby wrote:

> On 07/11/2009 12:17 PM, Jaswinder Singh Rajput wrote:
> > On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> >> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> >>> --- a/drivers/staging/otus/wwrap.c
> >>> +++ b/drivers/staging/otus/wwrap.c
> >>> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >>>  {
> >>>      struct usbdrv_private *macp =
> >>>                 container_of(work, struct usbdrv_private, kevent);
> >>> -    zdev_t *dev = macp->device;
> >>> +    zdev_t *dev;
> >>>  
> >>>      if (macp == NULL)
> >>>      {
> >>>          return;
> >>>      }
> >>
> >> The test is rather useless here.
> >>
> > 
> > Why useless, it should be non-null before setting to dev.
> 
> Even if work was NULL, macp won't be NULL.

work could be a small negative number such that calling container_of would 
return 0.

julia

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 11:32         ` Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11 11:32 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Jaswinder Singh Rajput, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Jiri Slaby wrote:

> On 07/11/2009 12:17 PM, Jaswinder Singh Rajput wrote:
> > On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> >> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> >>> --- a/drivers/staging/otus/wwrap.c
> >>> +++ b/drivers/staging/otus/wwrap.c
> >>> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >>>  {
> >>>      struct usbdrv_private *macp > >>>                 container_of(work, struct usbdrv_private, kevent);
> >>> -    zdev_t *dev = macp->device;
> >>> +    zdev_t *dev;
> >>>  
> >>>      if (macp = NULL)
> >>>      {
> >>>          return;
> >>>      }
> >>
> >> The test is rather useless here.
> >>
> > 
> > Why useless, it should be non-null before setting to dev.
> 
> Even if work was NULL, macp won't be NULL.

work could be a small negative number such that calling container_of would 
return 0.

julia

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11 11:32         ` Julia Lawall
@ 2009-07-11 11:58           ` Julia Lawall
  -1 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11 11:58 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Jaswinder Singh Rajput, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Julia Lawall wrote:

> On Sat, 11 Jul 2009, Jiri Slaby wrote:
> 
> > On 07/11/2009 12:17 PM, Jaswinder Singh Rajput wrote:
> > > On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> > >> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > >>> --- a/drivers/staging/otus/wwrap.c
> > >>> +++ b/drivers/staging/otus/wwrap.c
> > >>> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> > >>>  {
> > >>>      struct usbdrv_private *macp =
> > >>>                 container_of(work, struct usbdrv_private, kevent);
> > >>> -    zdev_t *dev = macp->device;
> > >>> +    zdev_t *dev;
> > >>>  
> > >>>      if (macp == NULL)
> > >>>      {
> > >>>          return;
> > >>>      }
> > >>
> > >> The test is rather useless here.
> > >>
> > > 
> > > Why useless, it should be non-null before setting to dev.
> > 
> > Even if work was NULL, macp won't be NULL.
> 
> work could be a small negative number such that calling container_of would 
> return 0.

On the other hand, that does not seem to be possible in this case, since 
work is passed through INIT_WORK, which dereferences the work value.

julia

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 11:58           ` Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11 11:58 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Jaswinder Singh Rajput, gregkh, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Julia Lawall wrote:

> On Sat, 11 Jul 2009, Jiri Slaby wrote:
> 
> > On 07/11/2009 12:17 PM, Jaswinder Singh Rajput wrote:
> > > On Sat, 2009-07-11 at 10:17 +0200, Jiri Slaby wrote:
> > >> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > >>> --- a/drivers/staging/otus/wwrap.c
> > >>> +++ b/drivers/staging/otus/wwrap.c
> > >>> @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> > >>>  {
> > >>>      struct usbdrv_private *macp > > >>>                 container_of(work, struct usbdrv_private, kevent);
> > >>> -    zdev_t *dev = macp->device;
> > >>> +    zdev_t *dev;
> > >>>  
> > >>>      if (macp = NULL)
> > >>>      {
> > >>>          return;
> > >>>      }
> > >>
> > >> The test is rather useless here.
> > >>
> > > 
> > > Why useless, it should be non-null before setting to dev.
> > 
> > Even if work was NULL, macp won't be NULL.
> 
> work could be a small negative number such that calling container_of would 
> return 0.

On the other hand, that does not seem to be possible in this case, since 
work is passed through INIT_WORK, which dereferences the work value.

julia

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11  8:17   ` Jiri Slaby
@ 2009-07-11 17:03     ` Greg KH
  -1 siblings, 0 replies; 24+ messages in thread
From: Greg KH @ 2009-07-11 17:03 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Julia Lawall, devel, linux-kernel, kernel-janitors

On Sat, Jul 11, 2009 at 10:17:24AM +0200, Jiri Slaby wrote:
> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > --- a/drivers/staging/otus/wwrap.c
> > +++ b/drivers/staging/otus/wwrap.c
> > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >  {
> >      struct usbdrv_private *macp =
> >                 container_of(work, struct usbdrv_private, kevent);
> > -    zdev_t *dev = macp->device;
> > +    zdev_t *dev;
> >  
> >      if (macp == NULL)
> >      {
> >          return;
> >      }
> 
> The test is rather useless here.

Yes it is. 

Julia, if you just remove the NULL check, will that keep your scripts
happy from noticing such a "problem"?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 17:03     ` Greg KH
  0 siblings, 0 replies; 24+ messages in thread
From: Greg KH @ 2009-07-11 17:03 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Julia Lawall, devel, linux-kernel, kernel-janitors

On Sat, Jul 11, 2009 at 10:17:24AM +0200, Jiri Slaby wrote:
> On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > --- a/drivers/staging/otus/wwrap.c
> > +++ b/drivers/staging/otus/wwrap.c
> > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> >  {
> >      struct usbdrv_private *macp > >                 container_of(work, struct usbdrv_private, kevent);
> > -    zdev_t *dev = macp->device;
> > +    zdev_t *dev;
> >  
> >      if (macp = NULL)
> >      {
> >          return;
> >      }
> 
> The test is rather useless here.

Yes it is. 

Julia, if you just remove the NULL check, will that keep your scripts
happy from noticing such a "problem"?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11 17:03     ` Greg KH
@ 2009-07-11 18:28       ` Julia Lawall
  -1 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11 18:28 UTC (permalink / raw)
  To: Greg KH; +Cc: Jiri Slaby, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Greg KH wrote:

> On Sat, Jul 11, 2009 at 10:17:24AM +0200, Jiri Slaby wrote:
> > On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > > --- a/drivers/staging/otus/wwrap.c
> > > +++ b/drivers/staging/otus/wwrap.c
> > > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> > >  {
> > >      struct usbdrv_private *macp =
> > >                 container_of(work, struct usbdrv_private, kevent);
> > > -    zdev_t *dev = macp->device;
> > > +    zdev_t *dev;
> > >  
> > >      if (macp == NULL)
> > >      {
> > >          return;
> > >      }
> > 
> > The test is rather useless here.
> 
> Yes it is. 
> 
> Julia, if you just remove the NULL check, will that keep your scripts
> happy from noticing such a "problem"?

Yes.  The trigger is the NULL test after the dereference.

julia

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-11 18:28       ` Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2009-07-11 18:28 UTC (permalink / raw)
  To: Greg KH; +Cc: Jiri Slaby, devel, linux-kernel, kernel-janitors

On Sat, 11 Jul 2009, Greg KH wrote:

> On Sat, Jul 11, 2009 at 10:17:24AM +0200, Jiri Slaby wrote:
> > On 07/11/2009 09:51 AM, Julia Lawall wrote:
> > > diff -u -p a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
> > > --- a/drivers/staging/otus/wwrap.c
> > > +++ b/drivers/staging/otus/wwrap.c
> > > @@ -1016,12 +1016,13 @@ void kevent(struct work_struct *work)
> > >  {
> > >      struct usbdrv_private *macp > > >                 container_of(work, struct usbdrv_private, kevent);
> > > -    zdev_t *dev = macp->device;
> > > +    zdev_t *dev;
> > >  
> > >      if (macp = NULL)
> > >      {
> > >          return;
> > >      }
> > 
> > The test is rather useless here.
> 
> Yes it is. 
> 
> Julia, if you just remove the NULL check, will that keep your scripts
> happy from noticing such a "problem"?

Yes.  The trigger is the NULL test after the dereference.

julia

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
  2009-07-11 11:09         ` Jiri Slaby
@ 2009-07-13 17:00           ` Luis R. Rodriguez
  -1 siblings, 0 replies; 24+ messages in thread
From: Luis R. Rodriguez @ 2009-07-13 17:00 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Jaswinder Singh Rajput, Luis Rodriguez, Julia Lawall, gregkh,
	devel, linux-kernel, kernel-janitors

On Sat, Jul 11, 2009 at 04:09:49AM -0700, Jiri Slaby wrote:
> On 07/11/2009 12:32 PM, Jaswinder Singh Rajput wrote:
> > And more funny thing is that all functions are global in this file.
> >
> > Greg, can you please check the scope of these function, why all are
> > global.
> 
> Why don't you do that? I think patches are welcome :).

I will note Otus has a replacement ar9170 driver already upstream,
as soon as it gets aggregation support otus will be dropped. Better
focus on ar9170 instead if you are looking to spend some cycles on
driver help.

  Luis

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] staging/otus: Move a dereference below a NULL test
@ 2009-07-13 17:00           ` Luis R. Rodriguez
  0 siblings, 0 replies; 24+ messages in thread
From: Luis R. Rodriguez @ 2009-07-13 17:00 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Jaswinder Singh Rajput, Luis Rodriguez, Julia Lawall, gregkh,
	devel, linux-kernel, kernel-janitors

On Sat, Jul 11, 2009 at 04:09:49AM -0700, Jiri Slaby wrote:
> On 07/11/2009 12:32 PM, Jaswinder Singh Rajput wrote:
> > And more funny thing is that all functions are global in this file.
> >
> > Greg, can you please check the scope of these function, why all are
> > global.
> 
> Why don't you do that? I think patches are welcome :).

I will note Otus has a replacement ar9170 driver already upstream,
as soon as it gets aggregation support otus will be dropped. Better
focus on ar9170 instead if you are looking to spend some cycles on
driver help.

  Luis

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2009-07-13 17:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-11  7:51 [PATCH 5/5] staging/otus: Move a dereference below a NULL test Julia Lawall
2009-07-11  7:51 ` Julia Lawall
2009-07-11  8:17 ` Jiri Slaby
2009-07-11  8:17   ` Jiri Slaby
2009-07-11  8:31   ` Julia Lawall
2009-07-11  8:31     ` Julia Lawall
2009-07-11 10:17   ` Jaswinder Singh Rajput
2009-07-11 10:29     ` Jaswinder Singh Rajput
2009-07-11 10:32     ` Jaswinder Singh Rajput
2009-07-11 10:44       ` Jaswinder Singh Rajput
2009-07-11 11:09       ` Jiri Slaby
2009-07-11 11:09         ` Jiri Slaby
2009-07-13 17:00         ` Luis R. Rodriguez
2009-07-13 17:00           ` Luis R. Rodriguez
2009-07-11 11:06     ` Jiri Slaby
2009-07-11 11:06       ` Jiri Slaby
2009-07-11 11:32       ` Julia Lawall
2009-07-11 11:32         ` Julia Lawall
2009-07-11 11:58         ` Julia Lawall
2009-07-11 11:58           ` Julia Lawall
2009-07-11 17:03   ` Greg KH
2009-07-11 17:03     ` Greg KH
2009-07-11 18:28     ` Julia Lawall
2009-07-11 18:28       ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.