Skip to contentSkip to conversation

drivers/isdn: about the loop after call isdn_tty_send_msg

Suggestion In review Chen Gang 2 participants 9 messages Feb 27, 2013 – Mar 29, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

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 }

#1 lore raw
Quoted 7 lines · Chen Gang

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.

Quoted 1 line

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

Yes, p should be NUL-terminated.

thanks,

Signature · 2 lines
js
suse labs
author
#2 lore raw
Quoted 2 lines · 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.

:-)

Signature · 3 lines
Chen Gang

Asianux Corporation
author
#3 lore raw

PATCH 1/1 drivers/isdn: break out of the loop after call isdn_tty_send_msg

In reply to Jiri Slaby

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

---
 drivers/isdn/i4l/isdn_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/i4l/isdn_tty.c +3 -1
index d8a7d83..8ac7b33 100644
@@ -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
Signature · 1 line
1.7.7.6
#4 lore raw

Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg

Quoted 4 lines · Chen Gang

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.

Quoted 28 lines
---
 drivers/isdn/i4l/isdn_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/i4l/isdn_tty.c +3 -1
index d8a7d83..8ac7b33 100644
@@ -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
Signature · 2 lines
js
suse labs
author
#5 lore raw

Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg

Hello Maintainers:

is it qualified to be applied ?

thanks.

Quoted 38 lines · Jiri Slaby
Quoted 4 lines · Chen Gang

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.

Quoted 28 lines
---
 drivers/isdn/i4l/isdn_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/i4l/isdn_tty.c +3 -1
index d8a7d83..8ac7b33 100644
@@ -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
Signature · 3 lines
Chen Gang

Asianux Corporation
author
#6 lore raw

Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg

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.

Quoted 48 lines · Chen Gang

Hello Maintainers:

is it qualified to be applied ?

thanks.

Quoted 38 lines · Jiri Slaby
Quoted 4 lines · Chen Gang

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.

Quoted 28 lines
---
 drivers/isdn/i4l/isdn_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/i4l/isdn_tty.c +3 -1
index d8a7d83..8ac7b33 100644
@@ -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
Signature · 3 lines
Chen Gang

Asianux Corporation
author
#7 lore raw

Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg

Hello Jiri Kosina:

could you help to check this patch whether is OK ?

thanks.

:-)

gchen.

Quoted 64 lines · Chen Gang

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.

Quoted 48 lines · Chen Gang

Hello Maintainers:

is it qualified to be applied ?

thanks.

Quoted 38 lines · Jiri Slaby
Quoted 4 lines · Chen Gang

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.

Quoted 28 lines
---
 drivers/isdn/i4l/isdn_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/i4l/isdn_tty.c +3 -1
index d8a7d83..8ac7b33 100644
@@ -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
Signature · 3 lines
Chen Gang

Asianux Corporation
author
#8 lore raw

Re: [PATCH] drivers/isdn: break out of the loop after call isdn_tty_send_msg

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.

Quoted 78 lines · Chen Gang

Hello Jiri Kosina:

could you help to check this patch whether is OK ?

thanks.

:-)

gchen.

Quoted 64 lines · Chen Gang

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.

Quoted 48 lines · Chen Gang

Hello Maintainers:

is it qualified to be applied ?

thanks.

Quoted 38 lines · Jiri Slaby
Quoted 4 lines · Chen Gang

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.

Quoted 28 lines
---
 drivers/isdn/i4l/isdn_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/i4l/isdn_tty.c +3 -1
index d8a7d83..8ac7b33 100644
@@ -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
Signature · 3 lines
Chen Gang

Asianux Corporation