Skip to contentSkip to conversation

How to mark suspicious code?

DISCUSSION Ivan Safonov 3 participants 7 messages Nov 5, 2015 – Nov 6, 2015

lore
Share & tools
lore
#0 lore raw

Hi all!

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

#1 lore raw

Hi all!

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

#2 lore raw
Quoted 3 lines · Ivan Safonov

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

#3 lore raw
Quoted 5 lines · Greg KH
Quoted 3 lines · Ivan Safonov

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?

Quoted 1 line

And also what do you mean by "suspicious"?

This is the wrong code that needs to be corrected.

Quoted 7 lines

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.

#4 lore raw
Quoted 68 lines · Ivan Safonov
Quoted 5 lines · Greg KH
Quoted 3 lines · Ivan Safonov

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?

Quoted 1 line

And also what do you mean by "suspicious"?

This is the wrong code that needs to be corrected.

Quoted 7 lines

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);
Quoted 1 line

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.

#5 lore raw
Quoted 43 lines · Greg KH
Quoted 42 lines · Ivan Safonov
Quoted 5 lines · Greg KH
Quoted 3 lines · Ivan Safonov

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?

Quoted 1 line

And also what do you mean by "suspicious"?

This is the wrong code that needs to be corrected.

Quoted 7 lines

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);
Quoted 2 lines
Quoted 2 lines

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

#6 lore raw
In reply to Greg KH
Quoted 69 lines · Greg KH
Quoted 68 lines · Ivan Safonov
Quoted 5 lines · Greg KH
Quoted 3 lines · Ivan Safonov

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?

Quoted 1 line

And also what do you mean by "suspicious"?

This is the wrong code that needs to be corrected.

Quoted 7 lines

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);
Quoted 4 lines
Quoted 1 line

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!