Re: [PATCH] drivers: staging: dgrp: type issue, unsigned number decreasing unsigned number will always be >= 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/06/2013 06:30 AM, Greg KH wrote:
> On Wed, Jun 05, 2013 at 08:58:27AM +0800, Chen Gang wrote:
>> > 
>> > The original author wanted to 'compare' between 'jiffies' and
>> > 'ch->ch_waketime', but both of them are unsigned, so the original
>> > 'comparation' is always true.
>> > 
>> > The related warning (with 'EXTRA_CFLAGS=-W')
>> >   drivers/staging/dgrp/dgrp_net_ops.c:1610:10: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
>> > 
>> > 
>> > Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
>> > ---
>> >  drivers/staging/dgrp/dgrp_net_ops.c |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>> > 
>> > diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c
>> > index 7a0d72d..120c55a 100644
>> > --- a/drivers/staging/dgrp/dgrp_net_ops.c
>> > +++ b/drivers/staging/dgrp/dgrp_net_ops.c
>> > @@ -1607,7 +1607,7 @@ static int dgrp_send(struct nd_struct *nd, long tmax)
>> >  					if ((ch->ch_pun.un_flag & UN_LOW) != 0 ?
>> >  					    (n <= TBUF_LOW) :
>> >  					    (ch->ch_pun.un_flag & UN_TIME) != 0 ?
>> > -					    ((jiffies - ch->ch_waketime) >= 0) :
>> > +					    (jiffies >= ch->ch_waketime) :
> What happens now when jiffies wraps?
> 
> Please use the proper jiffy comparison macros/functions instead of open
> coding this and probably getting it wrong.

OK, thanks. I will send patch v2 for it.

And excuse me, I have to do another things during these days, and almost
can not connect to net, so the patch v2 may be late, but I think I
should finish it within next Thursday: 2013-06-13

(and also welcome any other members to help send the related patch)


Thanks.
-- 
Chen Gang

Asianux Corporation
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux