netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Suggestion] drivers/isdn: about the loop after call isdn_tty_send_msg
@ 2013-02-27  9:32 Chen Gang
  2013-02-27 10:00 ` Jiri Slaby
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-02-27  9:32 UTC (permalink / raw)
  To: Jiri Kosina, isdn, Jiri Slaby; +Cc: Greg KH, Alan Cox, netdev

Hello Maintainers:

  do we need break out of the loop after call isdn_tty_send_msg ?
    p is not increased after finish calling isdn_tty_send_msg.
    and then will loop back to process the p again.

  do we intend to scan again the string which appended "+M..." ?

  we also assume "+M..." is a NUL terminated string, is it OK ? (it seems ok)


  thanks.

gchen.


in drivers/isdn/i4l/isdn_tty.c:


3408 static void
3409 isdn_tty_parse_at(modem_info *info)
3410 {
3411         atemu *m = &info->emu;
3412         char *p;
3413         char ds[ISDN_MSNLEN];
3414
3415 #ifdef ISDN_DEBUG_AT
3416         printk(KERN_DEBUG "AT: '%s'\n", m->mdmcmd);
3417 #endif
3418         for (p = &m->mdmcmd[2]; *p;) {
3419                 switch (*p) {
3420                 case ' ':
3421                         p++;
3422                         break;
...

3559                 case '+':
3560                         p++;
3561                         switch (*p) {
3562 #ifdef CONFIG_ISDN_AUDIO
3563                         case 'F':
3564                                 p++;
3565                                 if (isdn_tty_cmd_PLUSF(&p, info))
3566                                         return;
3567                                 break;
3568                         case 'V':
3569                                 if ((!(m->mdmreg[REG_SI1] & 1)) ||
3570                                     (m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM))
3571                                         PARSE_ERROR;
3572                                 p++;
3573                                 if (isdn_tty_cmd_PLUSV(&p, info))
3574                                         return;
3575                                 break;
3576 #endif                          /* CONFIG_ISDN_AUDIO */
3577                         case 'S':       /* SUSPEND */
3578                                 p++;
3579                                 isdn_tty_get_msnstr(ds, &p);
3580                                 isdn_tty_suspend(ds, info, m);
3581                                 break;
3582                         case 'R':       /* RESUME */
3583                                 p++;
3584                                 isdn_tty_get_msnstr(ds, &p);
3585                                 isdn_tty_resume(ds, info, m);
3586                                 break;
3587                         case 'M':       /* MESSAGE */
3588                                 p++;
3589                                 isdn_tty_send_msg(info, m, p);
3590                                 break;
3591                         default:
3592                                 PARSE_ERROR;
3593                         }
3594                         break;
3595                 case '&':
3596                         p++;
3597                         if (isdn_tty_cmd_ATand(&p, info))
3598                                 return;
3599                         break;
3600                 default:
3601                         PARSE_ERROR;
3602                 }
3603         }
3604 #ifdef CONFIG_ISDN_AUDIO
3605         if (!info->vonline)
3606 #endif
3607                 isdn_tty_modem_result(RESULT_OK, info);
3608 }

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

* Re: [Suggestion] drivers/isdn: about the loop after call isdn_tty_send_msg
  2013-02-27  9:32 [Suggestion] drivers/isdn: about the loop after call isdn_tty_send_msg Chen Gang
@ 2013-02-27 10:00 ` Jiri Slaby
  2013-02-27 10:08   ` Chen Gang
  2013-02-28  2:57   ` [PATCH] drivers/isdn: break out of " Chen Gang
  0 siblings, 2 replies; 9+ messages in thread
From: Jiri Slaby @ 2013-02-27 10:00 UTC (permalink / raw)
  To: Chen Gang, Jiri Kosina, isdn; +Cc: Greg KH, Alan Cox, netdev

On 02/27/2013 10:32 AM, Chen Gang wrote:
> Hello Maintainers:
> 
>   do we need break out of the loop after call isdn_tty_send_msg ?
>     p is not increased after finish calling isdn_tty_send_msg.
>     and then will loop back to process the p again.
> 
>   do we intend to scan again the string which appended "+M..." ?

Nope, we should break the for loop because isdn_tty_send_msg is intended
to eat the rest of the string. Evidently nobody tested this path yet.

>   we also assume "+M..." is a NUL terminated string, is it OK ? (it seems ok)

Yes, p should be NUL-terminated.

thanks,
-- 
js
suse labs

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

* Re: [Suggestion] drivers/isdn: about the loop after call isdn_tty_send_msg
  2013-02-27 10:00 ` Jiri Slaby
@ 2013-02-27 10:08   ` Chen Gang
  2013-02-28  2:57   ` [PATCH] drivers/isdn: break out of " Chen Gang
  1 sibling, 0 replies; 9+ messages in thread
From: Chen Gang @ 2013-02-27 10:08 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Jiri Kosina, isdn, Greg KH, Alan Cox, netdev

于 2013年02月27日 18:00, Jiri Slaby 写道:
> Nope, we should break the for loop because isdn_tty_send_msg is intended
> to eat the rest of the string. Evidently nobody tested this path yet.

  thank you for your reply.

  I will send relative patch, tomorrow. please help to check, thanks.

  :-)

-- 
Chen Gang

Asianux Corporation

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

* [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg
  2013-02-27 10:00 ` Jiri Slaby
  2013-02-27 10:08   ` Chen Gang
@ 2013-02-28  2:57   ` Chen Gang
  2013-02-28  9:54     ` Jiri Slaby
  1 sibling, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-02-28  2:57 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Jiri Kosina, isdn, Greg KH, Alan Cox, netdev


  need break out of the loop after call isdn_tty_send_msg.
    isdn_tty_send_msg is intended to eat the rest of the string.
    so need not scan again the string which appended "+M...".

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 drivers/isdn/i4l/isdn_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index d8a7d83..8ac7b33 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -3587,7 +3587,7 @@ isdn_tty_parse_at(modem_info *info)
 			case 'M':	/* MESSAGE */
 				p++;
 				isdn_tty_send_msg(info, m, p);
-				break;
+				goto tail;
 			default:
 				PARSE_ERROR;
 			}
@@ -3601,6 +3601,8 @@ isdn_tty_parse_at(modem_info *info)
 			PARSE_ERROR;
 		}
 	}
+
+tail:
 #ifdef CONFIG_ISDN_AUDIO
 	if (!info->vonline)
 #endif
-- 
1.7.7.6

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

* Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg
  2013-02-28  2:57   ` [PATCH] drivers/isdn: break out of " Chen Gang
@ 2013-02-28  9:54     ` Jiri Slaby
  2013-03-15  2:02       ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Jiri Slaby @ 2013-02-28  9:54 UTC (permalink / raw)
  To: Chen Gang; +Cc: Jiri Kosina, isdn, Greg KH, Alan Cox, netdev

On 02/28/2013 03:57 AM, Chen Gang wrote:
> 
>   need break out of the loop after call isdn_tty_send_msg.
>     isdn_tty_send_msg is intended to eat the rest of the string.
>     so need not scan again the string which appended "+M...".

Yes, looks good.

> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  drivers/isdn/i4l/isdn_tty.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
> index d8a7d83..8ac7b33 100644
> --- a/drivers/isdn/i4l/isdn_tty.c
> +++ b/drivers/isdn/i4l/isdn_tty.c
> @@ -3587,7 +3587,7 @@ isdn_tty_parse_at(modem_info *info)
>  			case 'M':	/* MESSAGE */
>  				p++;
>  				isdn_tty_send_msg(info, m, p);
> -				break;
> +				goto tail;
>  			default:
>  				PARSE_ERROR;
>  			}
> @@ -3601,6 +3601,8 @@ isdn_tty_parse_at(modem_info *info)
>  			PARSE_ERROR;
>  		}
>  	}
> +
> +tail:
>  #ifdef CONFIG_ISDN_AUDIO
>  	if (!info->vonline)
>  #endif
> 


-- 
js
suse labs

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

* Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg
  2013-02-28  9:54     ` Jiri Slaby
@ 2013-03-15  2:02       ` Chen Gang
  2013-03-20  5:03         ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-03-15  2:02 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Jiri Kosina, isdn, Greg KH, Alan Cox, netdev

Hello Maintainers:

  is it qualified to be applied ?

  thanks.


于 2013年02月28日 17:54, Jiri Slaby 写道:
> On 02/28/2013 03:57 AM, Chen Gang wrote:
>>
>>   need break out of the loop after call isdn_tty_send_msg.
>>     isdn_tty_send_msg is intended to eat the rest of the string.
>>     so need not scan again the string which appended "+M...".
> 
> Yes, looks good.
> 
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>>  drivers/isdn/i4l/isdn_tty.c |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
>> index d8a7d83..8ac7b33 100644
>> --- a/drivers/isdn/i4l/isdn_tty.c
>> +++ b/drivers/isdn/i4l/isdn_tty.c
>> @@ -3587,7 +3587,7 @@ isdn_tty_parse_at(modem_info *info)
>>  			case 'M':	/* MESSAGE */
>>  				p++;
>>  				isdn_tty_send_msg(info, m, p);
>> -				break;
>> +				goto tail;
>>  			default:
>>  				PARSE_ERROR;
>>  			}
>> @@ -3601,6 +3601,8 @@ isdn_tty_parse_at(modem_info *info)
>>  			PARSE_ERROR;
>>  		}
>>  	}
>> +
>> +tail:
>>  #ifdef CONFIG_ISDN_AUDIO
>>  	if (!info->vonline)
>>  #endif
>>
> 
> 


-- 
Chen Gang

Asianux Corporation

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

* Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg
  2013-03-15  2:02       ` Chen Gang
@ 2013-03-20  5:03         ` Chen Gang
  2013-03-25  3:27           ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-03-20  5:03 UTC (permalink / raw)
  To: Jiri Slaby, David Miller; +Cc: Jiri Kosina, isdn, Greg KH, Alan Cox, netdev

Hello Maintainers:

  did I send incorrect mail address ?
    ./scripts/get_maintainers.pl leads to cc netdev, but exclude David Miller.
    is it a bug of ./scripts/get_maintainers.pl ?
      (this time, I include him in this mail address).

  welcome any members to providing suggestions or completions.

  thanks.

gchen.

On 2013年03月15日 10:02, Chen Gang wrote:
> Hello Maintainers:
> 
>   is it qualified to be applied ?
> 
>   thanks.
> 
> 
> 于 2013年02月28日 17:54, Jiri Slaby 写道:
>> On 02/28/2013 03:57 AM, Chen Gang wrote:
>>>
>>>   need break out of the loop after call isdn_tty_send_msg.
>>>     isdn_tty_send_msg is intended to eat the rest of the string.
>>>     so need not scan again the string which appended "+M...".
>>
>> Yes, looks good.
>>
>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>>> ---
>>>  drivers/isdn/i4l/isdn_tty.c |    4 +++-
>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
>>> index d8a7d83..8ac7b33 100644
>>> --- a/drivers/isdn/i4l/isdn_tty.c
>>> +++ b/drivers/isdn/i4l/isdn_tty.c
>>> @@ -3587,7 +3587,7 @@ isdn_tty_parse_at(modem_info *info)
>>>  			case 'M':	/* MESSAGE */
>>>  				p++;
>>>  				isdn_tty_send_msg(info, m, p);
>>> -				break;
>>> +				goto tail;
>>>  			default:
>>>  				PARSE_ERROR;
>>>  			}
>>> @@ -3601,6 +3601,8 @@ isdn_tty_parse_at(modem_info *info)
>>>  			PARSE_ERROR;
>>>  		}
>>>  	}
>>> +
>>> +tail:
>>>  #ifdef CONFIG_ISDN_AUDIO
>>>  	if (!info->vonline)
>>>  #endif
>>>
>>
>>
> 
> 


-- 
Chen Gang

Asianux Corporation

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

* Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg
  2013-03-20  5:03         ` Chen Gang
@ 2013-03-25  3:27           ` Chen Gang
  2013-03-29  1:56             ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-03-25  3:27 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Jiri Slaby, David Miller, isdn, Greg KH, Alan Cox, netdev

Hello Jiri Kosina:

  could you help to check this patch whether is OK ?

  thanks.

  :-)

gchen.


On 2013年03月20日 13:03, Chen Gang wrote:
> Hello Maintainers:
> 
>   did I send incorrect mail address ?
>     ./scripts/get_maintainers.pl leads to cc netdev, but exclude David Miller.
>     is it a bug of ./scripts/get_maintainers.pl ?
>       (this time, I include him in this mail address).
> 
>   welcome any members to providing suggestions or completions.
> 
>   thanks.
> 
> gchen.
> 
> On 2013年03月15日 10:02, Chen Gang wrote:
>> Hello Maintainers:
>>
>>   is it qualified to be applied ?
>>
>>   thanks.
>>
>>
>> 于 2013年02月28日 17:54, Jiri Slaby 写道:
>>> On 02/28/2013 03:57 AM, Chen Gang wrote:
>>>>
>>>>   need break out of the loop after call isdn_tty_send_msg.
>>>>     isdn_tty_send_msg is intended to eat the rest of the string.
>>>>     so need not scan again the string which appended "+M...".
>>>
>>> Yes, looks good.
>>>
>>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>>>> ---
>>>>  drivers/isdn/i4l/isdn_tty.c |    4 +++-
>>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
>>>> index d8a7d83..8ac7b33 100644
>>>> --- a/drivers/isdn/i4l/isdn_tty.c
>>>> +++ b/drivers/isdn/i4l/isdn_tty.c
>>>> @@ -3587,7 +3587,7 @@ isdn_tty_parse_at(modem_info *info)
>>>>  			case 'M':	/* MESSAGE */
>>>>  				p++;
>>>>  				isdn_tty_send_msg(info, m, p);
>>>> -				break;
>>>> +				goto tail;
>>>>  			default:
>>>>  				PARSE_ERROR;
>>>>  			}
>>>> @@ -3601,6 +3601,8 @@ isdn_tty_parse_at(modem_info *info)
>>>>  			PARSE_ERROR;
>>>>  		}
>>>>  	}
>>>> +
>>>> +tail:
>>>>  #ifdef CONFIG_ISDN_AUDIO
>>>>  	if (!info->vonline)
>>>>  #endif
>>>>
>>>
>>>
>>
>>
> 
> 


-- 
Chen Gang

Asianux Corporation

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

* Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg
  2013-03-25  3:27           ` Chen Gang
@ 2013-03-29  1:56             ` Chen Gang
  0 siblings, 0 replies; 9+ messages in thread
From: Chen Gang @ 2013-03-29  1:56 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Jiri Slaby, David Miller, isdn, Greg KH, Alan Cox, netdev

Hello David Miller:

  could you help to check this patch whether is OK ?

  originally, it is my fault:
    not think of the mail addresses, after get them from ./scripts/get_maintainers.pl
    (I should fully use the tools, but should not depend on the tools)

  thanks.


On 2013年03月25日 11:27, Chen Gang wrote:
> Hello Jiri Kosina:
> 
>   could you help to check this patch whether is OK ?
> 
>   thanks.
> 
>   :-)
> 
> gchen.
> 
> 
> On 2013年03月20日 13:03, Chen Gang wrote:
>> Hello Maintainers:
>>
>>   did I send incorrect mail address ?
>>     ./scripts/get_maintainers.pl leads to cc netdev, but exclude David Miller.
>>     is it a bug of ./scripts/get_maintainers.pl ?
>>       (this time, I include him in this mail address).
>>
>>   welcome any members to providing suggestions or completions.
>>
>>   thanks.
>>
>> gchen.
>>
>> On 2013年03月15日 10:02, Chen Gang wrote:
>>> Hello Maintainers:
>>>
>>>   is it qualified to be applied ?
>>>
>>>   thanks.
>>>
>>>
>>> 于 2013年02月28日 17:54, Jiri Slaby 写道:
>>>> On 02/28/2013 03:57 AM, Chen Gang wrote:
>>>>>
>>>>>   need break out of the loop after call isdn_tty_send_msg.
>>>>>     isdn_tty_send_msg is intended to eat the rest of the string.
>>>>>     so need not scan again the string which appended "+M...".
>>>>
>>>> Yes, looks good.
>>>>
>>>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>>>>> ---
>>>>>  drivers/isdn/i4l/isdn_tty.c |    4 +++-
>>>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>>>
>>>>> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
>>>>> index d8a7d83..8ac7b33 100644
>>>>> --- a/drivers/isdn/i4l/isdn_tty.c
>>>>> +++ b/drivers/isdn/i4l/isdn_tty.c
>>>>> @@ -3587,7 +3587,7 @@ isdn_tty_parse_at(modem_info *info)
>>>>>  			case 'M':	/* MESSAGE */
>>>>>  				p++;
>>>>>  				isdn_tty_send_msg(info, m, p);
>>>>> -				break;
>>>>> +				goto tail;
>>>>>  			default:
>>>>>  				PARSE_ERROR;
>>>>>  			}
>>>>> @@ -3601,6 +3601,8 @@ isdn_tty_parse_at(modem_info *info)
>>>>>  			PARSE_ERROR;
>>>>>  		}
>>>>>  	}
>>>>> +
>>>>> +tail:
>>>>>  #ifdef CONFIG_ISDN_AUDIO
>>>>>  	if (!info->vonline)
>>>>>  #endif
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
> 
> 


-- 
Chen Gang

Asianux Corporation

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

end of thread, other threads:[~2013-03-29  2:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27  9:32 [Suggestion] drivers/isdn: about the loop after call isdn_tty_send_msg Chen Gang
2013-02-27 10:00 ` Jiri Slaby
2013-02-27 10:08   ` Chen Gang
2013-02-28  2:57   ` [PATCH] drivers/isdn: break out of " Chen Gang
2013-02-28  9:54     ` Jiri Slaby
2013-03-15  2:02       ` Chen Gang
2013-03-20  5:03         ` Chen Gang
2013-03-25  3:27           ` Chen Gang
2013-03-29  1:56             ` Chen Gang

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).