kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* How to mark suspicious code?
       [not found] <563B58FD.3080406@gmail.com>
@ 2015-11-06  1:45 ` Ivan Safonov
  2015-11-06  1:58   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Safonov @ 2015-11-06  1:45 UTC (permalink / raw)
  To: kernelnewbies

Hi all!

How can I mark suspicious code, if I can not fix it?

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

* How to mark suspicious code?
  2015-11-06  1:45 ` How to mark suspicious code? Ivan Safonov
@ 2015-11-06  1:58   ` Greg KH
  2015-11-06  3:28     ` Ivan Safonov
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2015-11-06  1:58 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Nov 06, 2015 at 08:45:46AM +0700, Ivan Safonov wrote:
> Hi all!
> 
> How can I mark suspicious code, if I can not fix it?

What do you mean by "mark"?

And also what do you mean by "suspicious"?

And why can't you fix it?

we need more details.

thanks,

greg k-h

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

* How to mark suspicious code?
  2015-11-06  1:58   ` Greg KH
@ 2015-11-06  3:28     ` Ivan Safonov
  2015-11-06  5:02       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Safonov @ 2015-11-06  3:28 UTC (permalink / raw)
  To: kernelnewbies

On 11/06/2015 08:58 AM, Greg KH wrote:
> On Fri, Nov 06, 2015 at 08:45:46AM +0700, Ivan Safonov wrote:
>> Hi all!
>>
>> How can I mark suspicious code, if I can not fix it?
> What do you mean by "mark"?
Leave a comment in the code, write a letter to maintainer, etc.
What to do?
> And also what do you mean by "suspicious"?
This is the wrong code that needs to be corrected.
> And why can't you fix it?
>
> we need more details.
>
> thanks,
>
> greg k-h
Correction of the code will change the behavior of the program.
For example:

     while (1) {
         if (down_interruptible(&pcmdpriv->cmd_queue_sema))
             break;

         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
             ...
             break;
         }
_next:
         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
             ...
             break;
         }
         ...
         if (!pcmd)
             continue;
         ...
         goto _next;
     }
     ...
     up(&pcmdpriv->terminate_cmdthread_sema);

Here down_interruptible(sem) in the loop but up(sem) only after the loop.
Corrected example below:

     if (down_interruptible(&pcmdpriv->cmd_queue_sema)) {
         ...
     }
     while (1) {
         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
             ...
             break;
         }
_next:
         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
             ...
             break;
         }
         ...
         if (!pcmd)
             continue;
         ...
         goto _next;
     }
     ...
     }
     up(&pcmdpriv->terminate_cmdthread_sema);

I can not test the corrected code on the device.

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

* How to mark suspicious code?
  2015-11-06  3:28     ` Ivan Safonov
@ 2015-11-06  5:02       ` Greg KH
  2015-11-06  5:39         ` Nicholas Mc Guire
  2015-11-06 14:38         ` Ivan Safonov
  0 siblings, 2 replies; 6+ messages in thread
From: Greg KH @ 2015-11-06  5:02 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Nov 06, 2015 at 10:28:31AM +0700, Ivan Safonov wrote:
> On 11/06/2015 08:58 AM, Greg KH wrote:
> >On Fri, Nov 06, 2015 at 08:45:46AM +0700, Ivan Safonov wrote:
> >>Hi all!
> >>
> >>How can I mark suspicious code, if I can not fix it?
> >What do you mean by "mark"?
> Leave a comment in the code, write a letter to maintainer, etc.
> What to do?
> >And also what do you mean by "suspicious"?
> This is the wrong code that needs to be corrected.
> >And why can't you fix it?
> >
> >we need more details.
> >
> >thanks,
> >
> >greg k-h
> Correction of the code will change the behavior of the program.
> For example:
> 
>     while (1) {
>         if (down_interruptible(&pcmdpriv->cmd_queue_sema))
>             break;
> 
>         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>             ...
>             break;
>         }
> _next:
>         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>             ...
>             break;
>         }
>         ...
>         if (!pcmd)
>             continue;
>         ...
>         goto _next;
>     }
>     ...
>     up(&pcmdpriv->terminate_cmdthread_sema);
> 
> Here down_interruptible(sem) in the loop but up(sem) only after the loop.
> Corrected example below:
> 
>     if (down_interruptible(&pcmdpriv->cmd_queue_sema)) {
>         ...
>     }
>     while (1) {
>         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>             ...
>             break;
>         }
> _next:
>         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>             ...
>             break;
>         }
>         ...
>         if (!pcmd)
>             continue;
>         ...
>         goto _next;
>     }
>     ...
>     }
>     up(&pcmdpriv->terminate_cmdthread_sema);
> 
> I can not test the corrected code on the device.

Make a patch, send it to the people and mailing list that
get_maintainer.pl shows and the developers will take it from there.

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

* How to mark suspicious code?
  2015-11-06  5:02       ` Greg KH
@ 2015-11-06  5:39         ` Nicholas Mc Guire
  2015-11-06 14:38         ` Ivan Safonov
  1 sibling, 0 replies; 6+ messages in thread
From: Nicholas Mc Guire @ 2015-11-06  5:39 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Nov 05, 2015 at 09:02:58PM -0800, Greg KH wrote:
> On Fri, Nov 06, 2015 at 10:28:31AM +0700, Ivan Safonov wrote:
> > On 11/06/2015 08:58 AM, Greg KH wrote:
> > >On Fri, Nov 06, 2015 at 08:45:46AM +0700, Ivan Safonov wrote:
> > >>Hi all!
> > >>
> > >>How can I mark suspicious code, if I can not fix it?
> > >What do you mean by "mark"?
> > Leave a comment in the code, write a letter to maintainer, etc.
> > What to do?
> > >And also what do you mean by "suspicious"?
> > This is the wrong code that needs to be corrected.
> > >And why can't you fix it?
> > >
> > >we need more details.
> > >
> > >thanks,
> > >
> > >greg k-h
> > Correction of the code will change the behavior of the program.
> > For example:
> > 
> >     while (1) {
> >         if (down_interruptible(&pcmdpriv->cmd_queue_sema))
> >             break;
> > 
> >         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
> >             ...
> >             break;
> >         }
> > _next:
> >         if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
> >             ...
> >             break;
> >         }
> >         ...
> >         if (!pcmd)
> >             continue;
> >         ...
> >         goto _next;
> >     }
> >     ...
> >     up(&pcmdpriv->terminate_cmdthread_sema);
> > 
> > Here down_interruptible(sem) in the loop but up(sem) only after the loop.
> > Corrected example below:

don't get it - what does 
  down_interruptible(&pcmdpriv->cmd_queue_sema)
have to do with:
  up(&pcmdpriv->terminate_cmdthread_sema)
its a different sem.

thx!
hofrat

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

* How to mark suspicious code?
  2015-11-06  5:02       ` Greg KH
  2015-11-06  5:39         ` Nicholas Mc Guire
@ 2015-11-06 14:38         ` Ivan Safonov
  1 sibling, 0 replies; 6+ messages in thread
From: Ivan Safonov @ 2015-11-06 14:38 UTC (permalink / raw)
  To: kernelnewbies

On 11/06/2015 12:02 PM, Greg KH wrote:
> On Fri, Nov 06, 2015 at 10:28:31AM +0700, Ivan Safonov wrote:
>> On 11/06/2015 08:58 AM, Greg KH wrote:
>>> On Fri, Nov 06, 2015 at 08:45:46AM +0700, Ivan Safonov wrote:
>>>> Hi all!
>>>>
>>>> How can I mark suspicious code, if I can not fix it?
>>> What do you mean by "mark"?
>> Leave a comment in the code, write a letter to maintainer, etc.
>> What to do?
>>> And also what do you mean by "suspicious"?
>> This is the wrong code that needs to be corrected.
>>> And why can't you fix it?
>>>
>>> we need more details.
>>>
>>> thanks,
>>>
>>> greg k-h
>> Correction of the code will change the behavior of the program.
>> For example:
>>
>>      while (1) {
>>          if (down_interruptible(&pcmdpriv->cmd_queue_sema))
>>              break;
>>
>>          if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>>              ...
>>              break;
>>          }
>> _next:
>>          if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>>              ...
>>              break;
>>          }
>>          ...
>>          if (!pcmd)
>>              continue;
>>          ...
>>          goto _next;
>>      }
>>      ...
>>      up(&pcmdpriv->terminate_cmdthread_sema);
>>
>> Here down_interruptible(sem) in the loop but up(sem) only after the loop.
>> Corrected example below:
>>
>>      if (down_interruptible(&pcmdpriv->cmd_queue_sema)) {
>>          ...
>>      }
>>      while (1) {
>>          if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>>              ...
>>              break;
>>          }
>> _next:
>>          if (padapter->bDriverStopped || padapter->bSurpriseRemoved) {
>>              ...
>>              break;
>>          }
>>          ...
>>          if (!pcmd)
>>              continue;
>>          ...
>>          goto _next;
>>      }
>>      ...
>>      }
>>      up(&pcmdpriv->terminate_cmdthread_sema);
>>
>> I can not test the corrected code on the device.
> Make a patch, send it to the people and mailing list that
> get_maintainer.pl shows and the developers will take it from there.
>
Thanks!

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

end of thread, other threads:[~2015-11-06 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <563B58FD.3080406@gmail.com>
2015-11-06  1:45 ` How to mark suspicious code? Ivan Safonov
2015-11-06  1:58   ` Greg KH
2015-11-06  3:28     ` Ivan Safonov
2015-11-06  5:02       ` Greg KH
2015-11-06  5:39         ` Nicholas Mc Guire
2015-11-06 14:38         ` Ivan Safonov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).