Skip to contentSkip to conversation

linux-next: build failure in drivers/mfd/aat2870-core.c

DISCUSSION Applied Paul Gortmaker 3 participants 4 messages Sep 28, 2011 – Oct 4, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi folks,

I was testing an x86_64 allyesconfig in today's next tree, and came across this compile error:

In file included from /home/paul/4.x/module.h/linux-2.6.git/arch/x86/include/asm/uaccess.h:575,

                 from /home/paul/4.x/module.h/linux-2.6.git/include/linux/uaccess.h:5,
                 from /home/paul/4.x/module.h/linux-2.6.git/drivers/mfd/aat2870-core.c:27:
In function ‘copy_from_user’,
    inlined from ‘aat2870_reg_write_file’ at /home/paul/4.x/module.h/linux-2.6.git/drivers/mfd/aat2870-core.c:304:

/home/paul/4.x/module.h/linux-2.6.git/arch/x86/include/asm/uaccess_64.h:64: error: call to ‘copy_from_user_overflow’ declared with attribute error: copy_from_user() buffer size is not provably correct make[3]: *** [drivers/mfd/aat2870-core.o] Error 1

I wasn't sure if any of you were aware of this yet. as I didn't see it mentioned in the recent linux-next traffic

Paul.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi, Paul

I have checked aat2870-core.c build problem when x86_64 and got the same error with you.

This error occurred since merged below change.
----------------------------------------------------------------------------------
commit da417bacc9143b934f1a480a25d0fb2bb648a820

Author: Stephen Boyd <[email protected]>
Date:   Wed Sep 28 10:50:29 2011 +1000

x86: implement strict user copy checks for x86_64
----------------------------------------------------------------------------------
The above change is check object size and copy size for copy_from_user() to prevent overflow.

The root cause is not matched type of size parameter for copy_from_user() in aat2870-core.c for x86_64.
Because I just passed int type for size parameter to copy_from_user(). It has no problem for i386, but has problem for x86_64.

This is the patch for this build problem. Please review it.

mfd: aat2870: Fix build failure for x86_64

---
 drivers/mfd/aat2870-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/aat2870-core.c +1 -1
index 345dc65..02c4201 100644
@@ -295,7 +295,7 @@ static ssize_t aat2870_reg_write_file(struct file *file,
 {
 	struct aat2870_data *aat2870 = file->private_data;
 	char buf[32];
-	int buf_size;
+	ssize_t buf_size;
 	char *start = buf;
 	unsigned long addr, val;
 	int ret;
Signature · 4 lines
1.7.1

Thanks,
Jin Park
#3 lore raw
Quoted 16 lines · Jin Park

Hi, Paul

I have checked aat2870-core.c build problem when x86_64 and got the same error with you.

This error occurred since merged below change.
----------------------------------------------------------------------------------
commit da417bacc9143b934f1a480a25d0fb2bb648a820

Author: Stephen Boyd <[email protected]>
Date:   Wed Sep 28 10:50:29 2011 +1000

x86: implement strict user copy checks for x86_64
----------------------------------------------------------------------------------
The above change is check object size and copy size for copy_from_user() to prevent overflow.

Quoted 7 lines

The root cause is not matched type of size parameter for copy_from_user() in aat2870-core.c for x86_64.
Because I just passed int type for size parameter to copy_from_user(). It has no problem for i386, but has problem for x86_64.

This is the patch for this build problem. Please review it.

You've got good information above about how you discovered the root cause and which pending commit triggers the issue, but then the commit below only has a minimal shortlog and no additional information whatsoever. I'd suggest capturing your information in the commit's long log, so it is there for everyone, and not just available to the people who happen to read this thread.

Thanks,
Paul.

Quoted 21 lines

mfd: aat2870: Fix build failure for x86_64

---
 drivers/mfd/aat2870-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/aat2870-core.c +1 -1
index 345dc65..02c4201 100644
@@ -295,7 +295,7 @@ static ssize_t aat2870_reg_write_file(struct file *file,
 {
 	struct aat2870_data *aat2870 = file->private_data;
 	char buf[32];
-	int buf_size;
+	ssize_t buf_size;
 	char *start = buf;
 	unsigned long addr, val;
 	int ret;
Applied
#4 lore raw
In reply to Jin Park

Hi Jin,

Quoted 16 lines · Jin Park

Hi, Paul

I have checked aat2870-core.c build problem when x86_64 and got the same error with you.

This error occurred since merged below change.
----------------------------------------------------------------------------------
commit da417bacc9143b934f1a480a25d0fb2bb648a820

Author: Stephen Boyd <[email protected]>
Date:   Wed Sep 28 10:50:29 2011 +1000

x86: implement strict user copy checks for x86_64
----------------------------------------------------------------------------------
The above change is check object size and copy size for copy_from_user() to prevent overflow.

Quoted 7 lines

The root cause is not matched type of size parameter for copy_from_user() in aat2870-core.c for x86_64.
Because I just passed int type for size parameter to copy_from_user(). It has no problem for i386, but has problem for x86_64.

This is the patch for this build problem. Please review it.

I applied this patch and fixed the changelog to be slightly more descriptive. Thanks a lot for the fix.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/