diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c index 0e941b57482e..6c4f4b5a9dd3 100644 --- a/drivers/char/generic_nvram.c +++ b/drivers/char/generic_nvram.c @@ -34,12 +34,16 @@ static ssize_t nvram_len; static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) { switch (origin) { + case 0: + break; case 1: offset += file->f_pos; break; case 2: offset += nvram_len; break; + default: + offset = -1; } if (offset < 0) return -EINVAL; diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 166f1e7aaa7e..da3cfee782dc 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -224,6 +224,8 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) case 2: offset += NVRAM_BYTES; break; + default: + return -EINVAL; } return (offset >= 0) ? (file->f_pos = offset) : -EINVAL; diff --git a/drivers/char/ps3flash.c b/drivers/char/ps3flash.c index 85c004a518ee..5a06787e5be3 100644 --- a/drivers/char/ps3flash.c +++ b/drivers/char/ps3flash.c @@ -101,12 +101,16 @@ static loff_t ps3flash_llseek(struct file *file, loff_t offset, int origin) mutex_lock(&file->f_mapping->host->i_mutex); switch (origin) { + case 0: + break; case 1: offset += file->f_pos; break; case 2: offset += dev->regions[dev->region_idx].size*dev->blk_size; break; + default: + offset = -1; } if (offset < 0) { res = -EINVAL; diff --git a/drivers/macintosh/nvram.c b/drivers/macintosh/nvram.c index a271c8218d82..f0e03e7937e3 100644 --- a/drivers/macintosh/nvram.c +++ b/drivers/macintosh/nvram.c @@ -21,12 +21,16 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) { switch (origin) { + case 0: + break; case 1: offset += file->f_pos; break; case 2: offset += NVRAM_SIZE; break; + default: + offset = -1; } if (offset < 0) return -EINVAL;