Bug 10121 - __you_cannot_kmalloc_that_much in hiddev.c with gcc 3.2
Summary: __you_cannot_kmalloc_that_much in hiddev.c with gcc 3.2
Status: CLOSED CODE_FIX
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Slab Allocator (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Christoph Lameter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-27 06:57 UTC by Alexander
Modified: 2008-04-23 02:43 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.24.3
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
.config (37.96 KB, text/plain)
2008-02-28 00:07 UTC, Alexander
Details
Proposed fix (8.81 KB, patch)
2008-02-29 14:07 UTC, Jean Delvare
Details | Diff

Description Alexander 2008-02-27 06:57:22 UTC
Latest working kernel version: 2.6.22.1
Earliest failing kernel version: 2.6.24

Problem Description:
Kernel compile finish with error:
  GEN     .version
  CHK     include/linux/compile.h
  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
drivers/built-in.o: In function `hiddev_ioctl':
hiddev.c:(.text+0xfcc43): undefined reference to `__you_cannot_kmalloc_that_much'
make: *** [.tmp_vmlinux1] Error 1

Steps to reproduce:
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
USB_HID=y in .config
Comment 1 Adrian Bunk 2008-02-27 07:12:22 UTC
Please attach your .config
Comment 2 Alexander 2008-02-28 00:07:13 UTC
Created attachment 15050 [details]
.config
Comment 3 Jean Delvare 2008-02-29 14:07:29 UTC
Created attachment 15099 [details]
Proposed fix

The trick is to move the handling of ioctls which need to allocate memory to separate functions. This fixes the problem for me, but needs some testing.
Comment 4 Christoph Lameter 2008-02-29 14:15:28 UTC
Right. We know that gcc 3.2 will fold constants again if the functions are smaller. That has also addressed the issue in other cases.  That also means that the issue will resurface if the function is bloated by further updates.
Comment 5 Adrian Bunk 2008-02-29 14:21:47 UTC
The alternative would be to move the minimum supported compiler version from 3.2 to 3.3 if this reoccuring issue (see e.g. #9669) convinces Linus of accepting a patch doing so.
Comment 6 Jean Delvare 2008-03-01 23:30:02 UTC
I don't think that we want to make gcc 3.3 the minimum supported compiler version. gcc 3.2 still has a significant pool of users. On top of that, overly large functions are bad anyway for many reasons, so I doubt that you will convince Linus: he might see this gcc 3.2 property as a feature not bug ;)
Comment 7 Adrian Bunk 2008-04-23 02:43:02 UTC
fixed by commit cf2a299e48cbeb6c942e1f765b92ca6058355f68

Note You need to log in before you can comment on or make changes to this bug.