comparison always false due to limited
Subsystems (2)
PATCH 1/1 comparison always false due to limited
Compiling 2.6.1 with -W as suggested somewhere in the TOSO list, i run into this warning:
drivers/atm/horizon.c: In function `hrz_check_args':drivers/atm/horizon.c:2905: warning: comparison is always false due to limited range of data type
the code affected was this:
if (max_rx_size > RX_AAL5_LIMIT)
PRINTK (KERN_NOTICE, "max_rx_size has been limited to %hu",
max_rx_size = RX_AAL5_LIMIT);
I could remove the code or make max_rx_size an int (was a short). Since removing code is usually not a good idea I made this patch:
drivers/atm/horizon.c 2004-01-18 16:08:16.000000000 +0100 renamed from drivers/atm/horizon.c 2003-12-19 10:34:10.000000000 +0100 +1 -1
@@ -360,7 +360,7 @@ static unsigned short debug = 0; static unsigned short vpi_bits = 0; static unsigned short max_tx_size = 9000; -static unsigned short max_rx_size = 9000; +static unsigned int max_rx_size = 9000; static unsigned char pci_lat = 0; /********** access functions **********/
There is also a similar warning for smbfs:fs/smbfs/inode.c: In function `smb_fill_super':fs/smbfs/inode.c:554: warning: comparison is always false due to limited range of data type fs/smbfs/inode.c:555: warning: comparison is always false due to limited range of data type but the code is much more complex (three nested macros).
Finally I saw this that made me laugh and wanted to share with someone else:drivers/char/applicom.c:522:2: warning: #warning "Je suis stupide. DW. - copy*user in cli"
Bye.
Signature · 8 lines
----------------------------- Daniele Venzano Web: http://teg.homeunix.org _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [Kernel-janitors] [PATCH] comparison always false due to
On Sun, 18 Jan 2004 16:26:08 +0100 Daniele Venzano <[email protected]> wrote:
| Compiling 2.6.1 with -W as suggested somewhere in the TOSO list, i run | into this warning: | | drivers/atm/horizon.c: In function `hrz_check_args': | drivers/atm/horizon.c:2905: warning: comparison is always false due to | limited range of data type | | the code affected was this: | | if (max_rx_size > RX_AAL5_LIMIT) | PRINTK (KERN_NOTICE, "max_rx_size has been limited to %hu", | max_rx_size = RX_AAL5_LIMIT);
Is this a real problem?
The code documents the limit/restriction/requirement, and it doesn't generate any code since it's always false. (Yes, I checked.)
| I could remove the code or make max_rx_size an int (was a short). Since | removing code is usually not a good idea I made this patch: | | --- linux-2.6.1/drivers/atm/horizon.c 2003-12-19 10:34:10.000000000 +0100 | +++ linux-2.6.1-kj/drivers/atm/horizon.c 2004-01-18 16:08:16.000000000 +0100 | @@ -360,7 +360,7 @@ | static unsigned short debug = 0; | static unsigned short vpi_bits = 0; | static unsigned short max_tx_size = 9000; | -static unsigned short max_rx_size = 9000; | +static unsigned int max_rx_size = 9000; | static unsigned char pci_lat = 0; | | /********** access functions **********/
Anyway the patch is incomplete. The MODULE_PARM() for max_rx_size should also be changed if the change above is made. MODULE_PARM(max_rx_size, "h");
^-- says that it's "short"
but doesn't do typechecking,
but new module param macros fix that.
--
~Randy
Everything is relative.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
I'm CCing the ATM maintainer, just in case he wants to check if this is really a bug.
Quoted 15 lines · Randy.Dunlap
On Sun, 18 Jan 2004 16:26:08 +0100 Daniele Venzano <[email protected]> wrote:
| Compiling 2.6.1 with -W as suggested somewhere in the TODO list, i run | into this warning: | | drivers/atm/horizon.c: In function `hrz_check_args': | drivers/atm/horizon.c:2905: warning: comparison is always false due to | limited range of data type | | the code affected was this: | | if (max_rx_size > RX_AAL5_LIMIT) | PRINTK (KERN_NOTICE, "max_rx_size has been limited to %hu", | max_rx_size = RX_AAL5_LIMIT);
Quoted 4 lines
Is this a real problem?
The code documents the limit/restriction/requirement, and it doesn't generate any code since it's always false. (Yes, I checked.)
Then I think you can just ignore the patch. I didn't know of the macro issue.
In a similar case I've sent mail to maintainers of the bonding driver where the comparison was always true and what seemed to be an error path was always taken.
I think I'll concentrate on these 'path always taken', then.
Quoted 6 lines
Anyway the patch is incomplete. The
MODULE_PARM()formax_rx_sizeshould also be changed if the change above is made.MODULE_PARM(max_rx_size, "h");
^-- says that it's "short"
but doesn't do typechecking,
but new module param macros fix that.
I test compiled the change but I was using allyesconfig, so no module was compiled.
Quoted 8 lines
--
~Randy
Everything is relative.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Signature · 8 lines
----------------------------- Daniele Venzano Web: http://teg.homeunix.org _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [Kernel-janitors] [PATCH] comparison always false due to
In reply to Daniele VenzanoOn Mon, 19 Jan 2004 21:38:39 +0100 Daniele Venzano <[email protected]> wrote:
| I'm CCing the ATM maintainer, just in case he wants to check if this is | really a bug.
Good idea, I should have done that. And thanks.
I'll leave it up to Chas then.
| On Mon, Jan 19, 2004 at 11:46:19AM -0800, Randy.Dunlap wrote: | > On Sun, 18 Jan 2004 16:26:08 +0100 Daniele Venzano <[email protected]> wrote: | > | > | Compiling 2.6.1 with -W as suggested somewhere in the TODO list, i run | > | into this warning: | > | | > | drivers/atm/horizon.c: In function `hrz_check_args': | > | drivers/atm/horizon.c:2905: warning: comparison is always false due to | > | limited range of data type | > | | > | the code affected was this: | > | | > | if (max_rx_size > RX_AAL5_LIMIT) | > | PRINTK (KERN_NOTICE, "max_rx_size has been limited to %hu", | > | max_rx_size = RX_AAL5_LIMIT); | > | > Is this a real problem? | > The code documents the limit/restriction/requirement, | > and it doesn't generate any code since it's always false. | > (Yes, I checked.) | | Then I think you can just ignore the patch. I didn't know of the macro | issue. | | In a similar case I've sent mail to maintainers of the bonding driver | where the comparison was always true and what seemed to be an error | path was always taken. | I think I'll concentrate on these 'path always taken', then. | | > Anyway the patch is incomplete. The MODULE_PARM() for max_rx_size | > should also be changed if the change above is made. | > MODULE_PARM(max_rx_size, "h"); | > ^-- says that it's "short" | > but doesn't do typechecking, | > but new module param macros fix that. | I test compiled the change but I was using allyesconfig, so no module | was compiled.
--
~Randy
Everything is relative.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
yeah it looks like a bug. i will just promote max_[rt]x_size to int and add some extra checking for values < 0.
Quoted 44 lines · In message <[email protected]>,Daniele Venzano writes:
I'm CCing the ATM maintainer, just in case he wants to check if this is really a bug.
Quoted 15 lines · Randy.Dunlap
On Sun, 18 Jan 2004 16:26:08 +0100 Daniele Venzano <[email protected]> wrote:
| Compiling 2.6.1 with -W as suggested somewhere in the TODO list, i run | into this warning: | | drivers/atm/horizon.c: In function `hrz_check_args': | drivers/atm/horizon.c:2905: warning: comparison is always false due to | limited range of data type | | the code affected was this: | | if (max_rx_size > RX_AAL5_LIMIT) | PRINTK (KERN_NOTICE, "max_rx_size has been limited to %hu", | max_rx_size = RX_AAL5_LIMIT);Quoted 4 lines
Is this a real problem?
The code documents the limit/restriction/requirement, and it doesn't generate any code since it's always false. (Yes, I checked.)Then I think you can just ignore the patch. I didn't know of the macro issue.
In a similar case I've sent mail to maintainers of the bonding driver where the comparison was always true and what seemed to be an error path was always taken.
I think I'll concentrate on these 'path always taken', then.Quoted 6 lines
Anyway the patch is incomplete. The
MODULE_PARM()formax_rx_sizeshould also be changed if the change above is made.MODULE_PARM(max_rx_size, "h");
^-- says that it's "short"
but doesn't do typechecking,
but new module param macros fix that.I test compiled the change but I was using allyesconfig, so no module was compiled.
Quoted 1 line
Quoted 14 lines
Quoted 7 lines
--
~Randy
Everything is relative.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitorsSignature · 3 lines
----------------------------- Daniele Venzano Web: http://teg.homeunix.org
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors