From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Thu, 5 Nov 2015 21:02:58 -0800 Subject: How to mark suspicious code? In-Reply-To: <563C1E5F.6090000@gmail.com> References: <563B58FD.3080406@gmail.com> <563C064A.1010108@gmail.com> <20151106015825.GA19427@kroah.com> <563C1E5F.6090000@gmail.com> Message-ID: <20151106050258.GA1599@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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.