Skip to content
Browse files

drivers/staging/speakup/devsynth.c: fix "buffer size is not provably …

…correct" error

x86_64 allmodconfig:

In file included from arch/x86/include/asm/uaccess.h:572,
                 from include/linux/uaccess.h:5,
                 from drivers/staging/speakup/devsynth.c:4:
In function 'copy_from_user',
    inlined from 'speakup_file_write' at drivers/staging/speakup/devsynth.c:28:
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

I'm not sure what was unprovable about it, but size_t is the correct type

Also replace needless min_t() with min()

Cc: William Hubbs <>
Cc: Arjan van de Ven <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Greg Kroah-Hartman <>
  • Loading branch information...
1 parent 8f89615 commit 09f9390d797ff34020faab866996884fd93a0081 Andrew Morton committed with gregkh Jul 28, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 drivers/staging/speakup/devsynth.c
5 drivers/staging/speakup/devsynth.c
@@ -18,13 +18,14 @@ static ssize_t speakup_file_write(struct file *fp, const char *buffer,
size_t count = nbytes;
const char *ptr = buffer;
- int bytes;
+ size_t bytes;
unsigned long flags;
u_char buf[256];
if (synth == NULL)
return -ENODEV;
while (count > 0) {
- bytes = min_t(size_t, count, sizeof(buf));
+ bytes = min(count, sizeof(buf));
if (copy_from_user(buf, ptr, bytes))
return -EFAULT;
count -= bytes;

0 comments on commit 09f9390

Please sign in to comment.
Something went wrong with that request. Please try again.