aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/generic_nvram.c4
-rw-r--r--drivers/char/nvram.c2
-rw-r--r--drivers/char/ps3flash.c4
-rw-r--r--drivers/macintosh/nvram.c4
4 files changed, 14 insertions, 0 deletions
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;
34static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) 34static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
35{ 35{
36 switch (origin) { 36 switch (origin) {
37 case 0:
38 break;
37 case 1: 39 case 1:
38 offset += file->f_pos; 40 offset += file->f_pos;
39 break; 41 break;
40 case 2: 42 case 2:
41 offset += nvram_len; 43 offset += nvram_len;
42 break; 44 break;
45 default:
46 offset = -1;
43 } 47 }
44 if (offset < 0) 48 if (offset < 0)
45 return -EINVAL; 49 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)
224 case 2: 224 case 2:
225 offset += NVRAM_BYTES; 225 offset += NVRAM_BYTES;
226 break; 226 break;
227 default:
228 return -EINVAL;
227 } 229 }
228 230
229 return (offset >= 0) ? (file->f_pos = offset) : -EINVAL; 231 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)
101 101
102 mutex_lock(&file->f_mapping->host->i_mutex); 102 mutex_lock(&file->f_mapping->host->i_mutex);
103 switch (origin) { 103 switch (origin) {
104 case 0:
105 break;
104 case 1: 106 case 1:
105 offset += file->f_pos; 107 offset += file->f_pos;
106 break; 108 break;
107 case 2: 109 case 2:
108 offset += dev->regions[dev->region_idx].size*dev->blk_size; 110 offset += dev->regions[dev->region_idx].size*dev->blk_size;
109 break; 111 break;
112 default:
113 offset = -1;
110 } 114 }
111 if (offset < 0) { 115 if (offset < 0) {
112 res = -EINVAL; 116 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 @@
21static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) 21static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
22{ 22{
23 switch (origin) { 23 switch (origin) {
24 case 0:
25 break;
24 case 1: 26 case 1:
25 offset += file->f_pos; 27 offset += file->f_pos;
26 break; 28 break;
27 case 2: 29 case 2:
28 offset += NVRAM_SIZE; 30 offset += NVRAM_SIZE;
29 break; 31 break;
32 default:
33 offset = -1;
30 } 34 }
31 if (offset < 0) 35 if (offset < 0)
32 return -EINVAL; 36 return -EINVAL;