From c10907b6b343ee0e7eaaf0b0440cca3b4465e89d Mon Sep 17 00:00:00 2001 From: Lekensteyn Date: Tue, 27 Dec 2011 16:04:12 +0100 Subject: [PATCH] bbswitch: silently ignore large writes --- bbswitch.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bbswitch.c b/bbswitch.c index 23cda17..b630de6 100644 --- a/bbswitch.c +++ b/bbswitch.c @@ -249,10 +249,8 @@ static ssize_t bbswitch_proc_write(struct file *fp, const char __user *buff, size_t len, loff_t *off) { char cmd[8]; - if (len >= sizeof(cmd)) { - printk(KERN_ERR "bbswitch: Input too large (%lu)\n", len); - return -ENOSPC; - } + if (len >= sizeof(cmd)) + len = sizeof(cmd) - 1; if (copy_from_user(cmd, buff, len)) return -EFAULT;