kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: insafonov@gmail.com (Ivan Safonov)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to mark suspicious code?
Date: Fri, 6 Nov 2015 21:38:18 +0700	[thread overview]
Message-ID: <563CBB5A.6080402@gmail.com> (raw)
In-Reply-To: <20151106050258.GA1599@kroah.com>

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!

      parent reply	other threads:[~2015-11-06 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563CBB5A.6080402@gmail.com \
    --to=insafonov@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).