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-next>] [day] [month] [year] [list]
Message-ID: <d02001e2-fa4c-6a2e-cc50-a8d9a8146d57@molgen.mpg.de>
Date:   Tue, 12 Jun 2018 23:50:45 +0200
From:   Paul Menzel <pmenzel+linux-hwmon@...gen.mpg.de>
To:     Guenter Roeck <linux@...ck-us.net>,
        Jean Delvare <jdelvare@...e.com>
Cc:     linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: nct6775: UBSAN: shift exponent 32 is too large for 32-bit type 'long
 unsigned int'

Dear Guenther, dear Jean,


Building Linux with the undefined behavior sanitizer (UBSAN), loading 
the module *nct6775* on the ASRock E350M1 shows the error below.

```
[   28.322775] UBSAN: Undefined behaviour in drivers/hwmon/nct6775.c:4179:27
[   28.322833] shift exponent 32 is too large for 32-bit type 'long 
unsigned int'
```

I believe this was introduced by commit cc66b3038254 (hwmon: (nct6775) 
Rework temperature source and label handling), but the same issue was 
already present before.

```
-       for (i = 0; i < data->temp_label_num - 1; i++) {
+       for (i = 0; i < 32; i++) {
+               if (!(data->temp_mask & BIT(i + 1)))
+                       continue;
```

`include/linux/bitops.h` has the macros below.

```
#define BIT(nr)                 (1UL << (nr))
#define BIT_ULL(nr)             (1ULL << (nr))
```

Maybe `BIT_ULL` should be used, but I do not know, if that’d would work 
with `data->temp_mask`, which has type `u32`.


Kind regards,

Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ