* [PATCH] isdn_v110 warning fix
@ 2005-08-29 23:05 Jesper Juhl
2005-08-30 8:20 ` Alexey Dobriyan
2005-08-30 10:51 ` Karsten Keil
0 siblings, 2 replies; 6+ messages in thread
From: Jesper Juhl @ 2005-08-29 23:05 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Thomas Pfeiffer, isdn4linux, Karsten Keil, Kai Germaschewski
Warning fix :
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/isdn/i4l/isdn_v110.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
--- linux-2.6.13-orig/drivers/isdn/i4l/isdn_v110.c 2005-08-29 01:41:01.000000000 +0200
+++ linux-2.6.13/drivers/isdn/i4l/isdn_v110.c 2005-08-30 00:59:34.000000000 +0200
@@ -516,11 +516,11 @@
}
int
-isdn_v110_stat_callback(int idx, isdn_ctrl * c)
+isdn_v110_stat_callback(int idx, isdn_ctrl *c)
{
isdn_v110_stream *v = NULL;
int i;
- int ret;
+ int ret = 0;
if (idx < 0)
return 0;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn_v110 warning fix
2005-08-29 23:05 [PATCH] isdn_v110 warning fix Jesper Juhl
@ 2005-08-30 8:20 ` Alexey Dobriyan
2005-08-30 8:42 ` Thomas Pfeiffer
2005-08-30 11:25 ` Jesper Juhl
2005-08-30 10:51 ` Karsten Keil
1 sibling, 2 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2005-08-30 8:20 UTC (permalink / raw)
To: Jesper Juhl
Cc: linux-kernel, Thomas Pfeiffer, isdn4linux, Karsten Keil,
Kai Germaschewski
On Tue, Aug 30, 2005 at 01:05:43AM +0200, Jesper Juhl wrote:
> drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
> --- linux-2.6.13-orig/drivers/isdn/i4l/isdn_v110.c
> +++ linux-2.6.13/drivers/isdn/i4l/isdn_v110.c
> @@ -516,11 +516,11 @@
> -isdn_v110_stat_callback(int idx, isdn_ctrl * c)
> +isdn_v110_stat_callback(int idx, isdn_ctrl *c)
> {
> isdn_v110_stream *v = NULL;
> int i;
> - int ret;
> + int ret = 0;
ret is used only in isdn_v110_stat_callback()::case ISDN_STAT_BSENT.
It's possible for it to be unused only if passed c->parm.length is 0.
Do you see codepaths that can do it?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn_v110 warning fix
2005-08-30 8:20 ` Alexey Dobriyan
@ 2005-08-30 8:42 ` Thomas Pfeiffer
2005-08-30 11:25 ` Jesper Juhl
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Pfeiffer @ 2005-08-30 8:42 UTC (permalink / raw)
To: Alexey Dobriyan, Jesper Juhl; +Cc: linux-kernel, isdn4linux
> On Tue, Aug 30, 2005 at 01:05:43AM +0200, Jesper Juhl wrote:
> > drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
>
> > --- linux-2.6.13-orig/drivers/isdn/i4l/isdn_v110.c
> > +++ linux-2.6.13/drivers/isdn/i4l/isdn_v110.c
> > @@ -516,11 +516,11 @@
>
> > -isdn_v110_stat_callback(int idx, isdn_ctrl * c)
> > +isdn_v110_stat_callback(int idx, isdn_ctrl *c)
> > {
> > isdn_v110_stream *v = NULL;
> > int i;
> > - int ret;
> > + int ret = 0;
>
> ret is used only in isdn_v110_stat_callback()::case ISDN_STAT_BSENT.
> It's possible for it to be unused only if passed c->parm.length is 0.
> Do you see codepaths that can do it?
>
initializing ret with the value zero is correct and should be
done.
---------------------------------------------------
Thomas Pfeiffer, PDS - Programm + Datenservice GmbH
email: pfeiffer@pds.de, http://www.pds.de/QFS-BILD
Tel: (49) 4261 855 614, Fax: (49) 4261 855 675
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn_v110 warning fix
2005-08-29 23:05 [PATCH] isdn_v110 warning fix Jesper Juhl
2005-08-30 8:20 ` Alexey Dobriyan
@ 2005-08-30 10:51 ` Karsten Keil
2005-08-30 13:47 ` Jesper Juhl
1 sibling, 1 reply; 6+ messages in thread
From: Karsten Keil @ 2005-08-30 10:51 UTC (permalink / raw)
To: Jesper Juhl
Cc: Linux Kernel Mailing List, Thomas Pfeiffer, isdn4linux,
Kai Germaschewski
On Tue, Aug 30, 2005 at 01:05:43AM +0200, Jesper Juhl wrote:
>
This is OK. Even if the codepath is never executed in a way that ret might
be used uninitialized it does not harm to set ret = 0.
Warning fix :
drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Karsten Keil <kkeil@suse.de>
---
drivers/isdn/i4l/isdn_v110.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
--- linux-2.6.13-orig/drivers/isdn/i4l/isdn_v110.c 2005-08-29 01:41:01.000000000 +0200
+++ linux-2.6.13/drivers/isdn/i4l/isdn_v110.c 2005-08-30 00:59:34.000000000 +0200
@@ -516,11 +516,11 @@
}
int
-isdn_v110_stat_callback(int idx, isdn_ctrl * c)
+isdn_v110_stat_callback(int idx, isdn_ctrl *c)
{
isdn_v110_stream *v = NULL;
int i;
- int ret;
+ int ret = 0;
if (idx < 0)
return 0;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn_v110 warning fix
2005-08-30 8:20 ` Alexey Dobriyan
2005-08-30 8:42 ` Thomas Pfeiffer
@ 2005-08-30 11:25 ` Jesper Juhl
1 sibling, 0 replies; 6+ messages in thread
From: Jesper Juhl @ 2005-08-30 11:25 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: linux-kernel, Thomas Pfeiffer, isdn4linux, Karsten Keil,
Kai Germaschewski
On 8/30/05, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> On Tue, Aug 30, 2005 at 01:05:43AM +0200, Jesper Juhl wrote:
> > drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
>
> > --- linux-2.6.13-orig/drivers/isdn/i4l/isdn_v110.c
> > +++ linux-2.6.13/drivers/isdn/i4l/isdn_v110.c
> > @@ -516,11 +516,11 @@
>
> > -isdn_v110_stat_callback(int idx, isdn_ctrl * c)
> > +isdn_v110_stat_callback(int idx, isdn_ctrl *c)
> > {
> > isdn_v110_stream *v = NULL;
> > int i;
> > - int ret;
> > + int ret = 0;
>
> ret is used only in isdn_v110_stat_callback()::case ISDN_STAT_BSENT.
> It's possible for it to be unused only if passed c->parm.length is 0.
> Do you see codepaths that can do it?
>
No, I don't see any codepaths that could lead to it being used uninitialized.
I made the patch for two reasons; 1) To silence the warning, and I
guess it's simply the right thing to do. 2) To make sure the code
behaves in a resonably sane way in case the situation
c->parm.length==0 should somehow happen in the future.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn_v110 warning fix
2005-08-30 10:51 ` Karsten Keil
@ 2005-08-30 13:47 ` Jesper Juhl
0 siblings, 0 replies; 6+ messages in thread
From: Jesper Juhl @ 2005-08-30 13:47 UTC (permalink / raw)
To: Karsten Keil
Cc: Linux Kernel Mailing List, Thomas Pfeiffer, isdn4linux,
Kai Germaschewski
On 8/30/05, Karsten Keil <kkeil@suse.de> wrote:
> On Tue, Aug 30, 2005 at 01:05:43AM +0200, Jesper Juhl wrote:
> >
>
> This is OK. Even if the codepath is never executed in a way that ret might
> be used uninitialized it does not harm to set ret = 0.
>
>
> Warning fix :
> drivers/isdn/i4l/isdn_v110.c:523: warning: `ret' might be used uninitialized in this function
>
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
> Signed-off-by: Karsten Keil <kkeil@suse.de>
>
Thank you for your feedback and for signing off on the patch. I'll
forward it to Andrew for inclusion in -mm.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-08-30 13:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-29 23:05 [PATCH] isdn_v110 warning fix Jesper Juhl
2005-08-30 8:20 ` Alexey Dobriyan
2005-08-30 8:42 ` Thomas Pfeiffer
2005-08-30 11:25 ` Jesper Juhl
2005-08-30 10:51 ` Karsten Keil
2005-08-30 13:47 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox