lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTin-iC8HFm2dmCmRTfYcBDDRbjZnFw@mail.gmail.com>
Date:	Wed, 8 Jun 2011 23:17:21 -0700
From:	Connor Hansen <cmdkhh@...il.com>
To:	Connor Hansen <cmdkhh@...il.com>, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org, randy.dunlap@...cle.com, greg@...ah.com,
	joe@...ches.com
Subject: Re: [PATCH RESEND]Remove a warning for drivers/edac/i82975x_edac.c

On Wed, Jun 8, 2011 at 10:25 PM, Harry Wei <jiaweiwei.xiyou@...il.com> wrote:
> On Wed, Jun 08, 2011 at 09:26:46PM -0700, Connor Hansen wrote:
>> When I compile 3.0.0-rc2+ I don't get this warning.
>> please make sure this issue still exists.
> I have not compiled 3.0.0-rc2+, but
> i fetch portions of drivers/edac/i82975x_edac.c
> of 3.0.0-rc2+ like below.
>
> [...]
> 296         page = (unsigned long) info->eap;
> 297         if (info->xeap & 1)
> 298                 page |= 0x100000000ul;
> 299         chan = page & 1;
> 300         page >>= 1;
> [...]
>

this code is the same in 3.0.0-rc2+ but produces no warning.

> The following codes prove this warning
> remians.
>
> #include <stdio.h>
>
> int main(void)
> {
>        unsigned long a;
>
>        a = 0x100000000ul;
>        printf("%lu\n", a);
>        return 0;
> }

this is not what the code you are changing does.

the code is not assigned that value, its or'd with it.

a test would be more like.

#include <stdio.h>
int main()
{
        unsigned long page;  //page
        unsigned int b = 5;  //info->eap is u32 = unsigned int
                                       // typedef unsigned int __u32;
        page = (unsigned long) b;
        page |= 0x10000000ul;

        printf("%lu\n",page);

        return 0;
}

This produces no warning.
$ gcc -g test.c && ./a.out
268435461
$

0x10000000
10000000000000000000000000000
5
00000000000000000000000000101
0x10000000 | 5 =
10000000000000000000000000101
268435461

I am green to kernel development so I will wait for someone with a bit
more knowledge to
chime in, or verify this warning.
Connor

>
> jiawei@...wei-laptop:~/GTK$ gcc 5.c -Wall -o 1
> 5.c: In function ‘main’:
> 5.c:7: warning: integer constant is too large for ‘unsigned long’ type
> 5.c:7: warning: large integer implicitly truncated to unsigned type
>
> But if you program it like below, it is well for us.
>
> #include <stdio.h>
>
> int main(void)
> {
>        unsigned long long a;
>
>        a = 0x100000000ull;
>        printf("%llu\n", a);
>        return 0;
> }
>
> Thanks
> Harry Wei
>> Connor
>>
>> On Wed, Jun 8, 2011 at 8:04 PM, Harry Wei <jiaweiwei.xiyou@...il.com> wrote:
>> > From: Harry Wei <harryxiyou@...il.com>
>> >
>> > When i compile 2.6.39.1, a warning shows like below.
>> > This patch can fix the warning. And i works well with
>> > my PC.
>> >
>> > [...]
>> > CC [M] ??drivers/edac/e752x_edac.o
>> > CC [M] ??drivers/edac/i82875p_edac.o
>> > CC [M] ??drivers/edac/i82975x_edac.o
>> > drivers/edac/i82975x_edac.c: In function ?????????i82975x_process_error_info?????????:
>> > drivers/edac/i82975x_edac.c:298: warning: integer constant is too large for ?????????unsigned long????????? type
>> > CC [M] ??drivers/edac/i3000_edac.o
>> > CC [M] ??drivers/edac/i3200_edac.o
>> > CC [M] ??drivers/edac/x38_edac.o
>> > CC [M] ??drivers/edac/i82860_edac.o
>> > [...]
>> >
>> >
>> > Signed-off-by: Harry Wei <harryxiyou@...il.com>
>> > Index: prj/drivers/edac/i82975x_edac.c
>> > ===================================================================
>> > --- prj.orig/drivers/edac/i82975x_edac.c ?? ?? ?? ??2011-06-04 10:09:55.351174516 +0800
>> > +++ prj/drivers/edac/i82975x_edac.c ?? ?? 2011-06-04 10:10:30.875168437 +0800
>> > @@ -293,9 +293,9 @@
>> > ?? ?? ?? ?? ?? ?? ?? ??info->errsts = info->errsts2;
>> > ?? ?? ?? ??}
>> >
>> > - ?? ?? ?? page = (unsigned long) info->eap;
>> > + ?? ?? ?? page = (unsigned long long) info->eap;
>> > ?? ?? ?? ??if (info->xeap & 1)
>> > - ?? ?? ?? ?? ?? ?? ?? page |= 0x100000000ul;
>> > + ?? ?? ?? ?? ?? ?? ?? page |= 0x100000000ull;
>> > ?? ?? ?? ??chan = page & 1;
>> > ?? ?? ?? ??page >>= 1;
>> > ?? ?? ?? ??offst = page & ((1 << PAGE_SHIFT) - 1);
>> > --
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ