Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - pidin : (12 Items)
   
pidin  
No biggy but line  1054  in pidin_proc.c (166123)

	for (i = 0; args[i] && i < sizeof args / sizeof args[0]; i++) {

Should read

	for (i = 0; i < sizeof args / sizeof args[0] && args[i]; i++) {

Re: pidin  
On Mon, 2008-04-14 at 12:08 -0400, Mario Charest wrote:
> 
> No biggy but line  1054  in pidin_proc.c (166123)
> 
>         for (i = 0; args[i] && i < sizeof args / sizeof args[0]; i++)
> {
> 
> Should read
> 
>         for (i = 0; i < sizeof args / sizeof args[0] && args[i]; i++)
> {

Good catch.  Thanks.

RE: pidin  
Care to explain for those of us who are missing the point? Namely, me. =)

Thanks and cheers,
-Brian 

> -----Original Message-----
> From: Stephane Boucher [mailto:sboucher@qnx.com] 
> Sent: Monday, April 14, 2008 12 22
> To: ostech-core_os
> Subject: Re: pidin
> 
> On Mon, 2008-04-14 at 12:08 -0400, Mario Charest wrote:
> > 
> > No biggy but line  1054  in pidin_proc.c (166123)
> > 
> >         for (i = 0; args[i] && i < sizeof args / sizeof 
> args[0]; i++)
> > {
> > 
> > Should read
> > 
> >         for (i = 0; i < sizeof args / sizeof args[0] && 
> args[i]; i++)
> > {
> 
> Good catch.  Thanks.
> 
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post6734
> 
RE: pidin  
On Mon, 2008-04-14 at 12:34 -0400, Brian Hlady wrote:
> Care to explain for those of us who are missing the point? Namely, me.
> =)
> 

You want to make sure 'i' is valid before you use it to access the
array.  There's a theoretical possibility that you might fault accessing
argv[i] if is beyond the end of the array.

> Thanks and cheers, 
> -Brian 
> 
> > -----Original Message----- 
> > From: Stephane Boucher [mailto:sboucher@qnx.com] 
> > Sent: Monday, April 14, 2008 12 22 
> > To: ostech-core_os 
> > Subject: Re: pidin 
> > 
> > On Mon, 2008-04-14 at 12:08 -0400, Mario Charest wrote: 
> > > 
> > > No biggy but line  1054  in pidin_proc.c (166123) 
> > > 
> > >         for (i = 0; args[i] && i < sizeof args / sizeof 
> > args[0]; i++) 
> > > { 
> > > 
> > > Should read 
> > > 
> > >         for (i = 0; i < sizeof args / sizeof args[0] && 
> > args[i]; i++) 
> > > { 
> > 
> > Good catch.  Thanks. 
> > 
> > 
> > 
> > _______________________________________________ 
> > OSTech 
> > http://community.qnx.com/sf/go/post6734 
> > 
> 
> _______________________________________________ 
> OSTech 
> http://community.qnx.com/sf/go/post6737
> 
RE: pidin  
Ahh, thanks for clearing that up. It's very much appreciated.

Cheers,
-Brian 

> -----Original Message-----
> From: Stephane Boucher [mailto:sboucher@qnx.com] 
> Sent: Monday, April 14, 2008 12 38
> To: ostech-core_os
> Subject: RE: pidin
> 
> On Mon, 2008-04-14 at 12:34 -0400, Brian Hlady wrote:
> > Care to explain for those of us who are missing the point? 
> Namely, me.
> > =)
> > 
> 
> You want to make sure 'i' is valid before you use it to access the
> array.  There's a theoretical possibility that you might 
> fault accessing
> argv[i] if is beyond the end of the array.
> 
> > Thanks and cheers, 
> > -Brian 
> > 
> > > -----Original Message----- 
> > > From: Stephane Boucher [mailto:sboucher@qnx.com] 
> > > Sent: Monday, April 14, 2008 12 22 
> > > To: ostech-core_os 
> > > Subject: Re: pidin 
> > > 
> > > On Mon, 2008-04-14 at 12:08 -0400, Mario Charest wrote: 
> > > > 
> > > > No biggy but line  1054  in pidin_proc.c (166123) 
> > > > 
> > > >         for (i = 0; args[i] && i < sizeof args / sizeof 
> > > args[0]; i++) 
> > > > { 
> > > > 
> > > > Should read 
> > > > 
> > > >         for (i = 0; i < sizeof args / sizeof args[0] && 
> > > args[i]; i++) 
> > > > { 
> > > 
> > > Good catch.  Thanks. 
> > > 
> > > 
> > > 
> > > _______________________________________________ 
> > > OSTech 
> > > http://community.qnx.com/sf/go/post6734 
> > > 
> > 
> > _______________________________________________ 
> > OSTech 
> > http://community.qnx.com/sf/go/post6737
> > 
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post6740
> 
Re: pidin  
On Mon, Apr 14, 2008 at 12:34 PM, Brian K Hlady <bhlady@qnx.com> wrote:

> Care to explain for those of us who are missing the point? Namely, me. =)
>
If you are going to check the bounds, you should probably not dereference it
before you do so.  In this case the check doesn't matter since it is more of
an early out rather than a limit on the bounds, but you know ... things
happen.

Thomas


>
> > -----Original Message-----
> > From: Stephane Boucher [mailto:sboucher@qnx.com]
> > Sent: Monday, April 14, 2008 12 22
> > To: ostech-core_os
> > Subject: Re: pidin
> >
> > On Mon, 2008-04-14 at 12:08 -0400, Mario Charest wrote:
> > >
> > > No biggy but line  1054  in pidin_proc.c (166123)
> > >
> > >         for (i = 0; args[i] && i < sizeof args / sizeof
> > args[0]; i++)
> > > {
> > >
> > > Should read
> > >
> > >         for (i = 0; i < sizeof args / sizeof args[0] &&
> > args[i]; i++)
> > > {
> >
> > Good catch.  Thanks.
> >
> >
> >
> > _______________________________________________
> > OSTech
> > http://community.qnx.com/sf/go/post6734
> >
>
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post6737
>
>
RE: pidin  
I seem to have lazily evaluated the lazy evaluation. =)

Thanks Thomas. 

> -----Original Message-----
> From: Thomas Fletcher [mailto:tfletche@gmail.com] 
> Sent: Tuesday, April 15, 2008 20 12
> To: ostech-core_os
> Subject: Re: pidin
> 
> On Mon, Apr 14, 2008 at 12:34 PM, Brian K Hlady 
> <bhlady@qnx.com> wrote:
> 
> > Care to explain for those of us who are missing the point? 
> Namely, me. =)
> >
> If you are going to check the bounds, you should probably not 
> dereference it
> before you do so.  In this case the check doesn't matter 
> since it is more of
> an early out rather than a limit on the bounds, but you know 
> ... things
> happen.
> 
> Thomas
> 
> 
> >
> > > -----Original Message-----
> > > From: Stephane Boucher [mailto:sboucher@qnx.com]
> > > Sent: Monday, April 14, 2008 12 22
> > > To: ostech-core_os
> > > Subject: Re: pidin
> > >
> > > On Mon, 2008-04-14 at 12:08 -0400, Mario Charest wrote:
> > > >
> > > > No biggy but line  1054  in pidin_proc.c (166123)
> > > >
> > > >         for (i = 0; args[i] && i < sizeof args / sizeof
> > > args[0]; i++)
> > > > {
> > > >
> > > > Should read
> > > >
> > > >         for (i = 0; i < sizeof args / sizeof args[0] &&
> > > args[i]; i++)
> > > > {
> > >
> > > Good catch.  Thanks.
> > >
> > >
> > >
> > > _______________________________________________
> > > OSTech
> > > http://community.qnx.com/sf/go/post6734
> > >
> >
> > _______________________________________________
> > OSTech
> > http://community.qnx.com/sf/go/post6737
> >
> >
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post6859
> 
Re: RE: pidin  
I would expect that lint can catch this but no?
RE: RE: pidin  
pclint cought it.

-----Original Message-----
From: Yao Zhao [mailto:yzhao@qnx.com] 
Sent: Wednesday, April 30, 2008 2:26 PM
To: ostech-core_os
Subject: Re: RE: pidin

I would expect that lint can catch this but no?

_______________________________________________
OSTech
http://community.qnx.com/sf/go/post7516

Re: RE: RE: pidin  
> pclint cought it.
> 
> -----Original Message-----
> From: Yao Zhao [mailto:yzhao@qnx.com] 
> Sent: Wednesday, April 30, 2008 2:26 PM
> To: ostech-core_os
> Subject: Re: RE: pidin
> 
> I would expect that lint can catch this but no?
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post7516
> 


that is it:) 
but we do run lint on kernel source so maybe we turned some warning off:(
RE: RE: RE: pidin  
We run lint on services/system and lib/c

-----Original Message-----
From: Yao Zhao 
Sent: Wednesday, April 30, 2008 10:38 PM
To: ostech-core_os
Subject: Re: RE: RE: pidin

> pclint cought it.
> 
> -----Original Message-----
> From: Yao Zhao [mailto:yzhao@qnx.com] 
> Sent: Wednesday, April 30, 2008 2:26 PM
> To: ostech-core_os
> Subject: Re: RE: pidin
> 
> I would expect that lint can catch this but no?
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post7516
> 


that is it:) 
but we do run lint on kernel source so maybe we turned some warning off:(

_______________________________________________
OSTech
http://community.qnx.com/sf/go/post7540
Re: RE: RE: RE: pidin  
> We run lint on services/system and lib/c
> 
> -----Original Message-----
> From: Yao Zhao 
> Sent: Wednesday, April 30, 2008 10:38 PM
> To: ostech-core_os
> Subject: Re: RE: RE: pidin
> 
> > pclint cought it.
> > 
> > -----Original Message-----
> > From: Yao Zhao [mailto:yzhao@qnx.com] 
> > Sent: Wednesday, April 30, 2008 2:26 PM
> > To: ostech-core_os
> > Subject: Re: RE: pidin
> > 
> > I would expect that lint can catch this but no?
> > 
> > _______________________________________________
> > OSTech
> > http://community.qnx.com/sf/go/post7516
> > 
> 
> 
> that is it:) 
> but we do run lint on kernel source so maybe we turned some warning off:(
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post7540


oh! it is pidin source, I miss that :)