How to mark suspicious code?

Nicholas Mc Guire der.herr at hofr.at
Fri Nov 6 00:39:13 EST 2015


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



More information about the Kernelnewbies mailing list