aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJay Estabrook <jay.estabrook@gmail.com>2013-11-16 19:45:31 -0500
committerMatt Turner <mattst88@gmail.com>2013-11-16 19:48:42 -0500
commit5cfe8f1ba5eebe6f4b6e5858cdb1a5be4f3272a6 (patch)
treefd5784acb203c3243c033d9fe6504792d7f1fd0b /arch
parent6e22f8f2e8d81dcab4c40bc229d53388fda63dbc (diff)
alpha: Prevent a NULL ptr dereference in csum_partial_copy.
Introduced by 3ddc5b46a8e90f3c92 ("kernel-wide: fix missing validations on __get/__put/__copy_to/__copy_from_user()"). Also fix some other places which could be problematic in a similar way, although they hadn't been proved so, as far as I can tell. Cc: Michael Cree <mcree@orcon.net.nz> Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/lib/csum_partial_copy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
index ffb19b7da999..ff3c10721caf 100644
--- a/arch/alpha/lib/csum_partial_copy.c
+++ b/arch/alpha/lib/csum_partial_copy.c
@@ -130,7 +130,7 @@ csum_partial_cfu_aligned(const unsigned long __user *src, unsigned long *dst,
130 *dst = word | tmp; 130 *dst = word | tmp;
131 checksum += carry; 131 checksum += carry;
132 } 132 }
133 if (err) *errp = err; 133 if (err && errp) *errp = err;
134 return checksum; 134 return checksum;
135} 135}
136 136
@@ -185,7 +185,7 @@ csum_partial_cfu_dest_aligned(const unsigned long __user *src,
185 *dst = word | tmp; 185 *dst = word | tmp;
186 checksum += carry; 186 checksum += carry;
187 } 187 }
188 if (err) *errp = err; 188 if (err && errp) *errp = err;
189 return checksum; 189 return checksum;
190} 190}
191 191
@@ -242,7 +242,7 @@ csum_partial_cfu_src_aligned(const unsigned long __user *src,
242 stq_u(partial_dest | second_dest, dst); 242 stq_u(partial_dest | second_dest, dst);
243out: 243out:
244 checksum += carry; 244 checksum += carry;
245 if (err) *errp = err; 245 if (err && errp) *errp = err;
246 return checksum; 246 return checksum;
247} 247}
248 248
@@ -325,7 +325,7 @@ csum_partial_cfu_unaligned(const unsigned long __user * src,
325 stq_u(partial_dest | word | second_dest, dst); 325 stq_u(partial_dest | word | second_dest, dst);
326 checksum += carry; 326 checksum += carry;
327 } 327 }
328 if (err) *errp = err; 328 if (err && errp) *errp = err;
329 return checksum; 329 return checksum;
330} 330}
331 331
@@ -339,7 +339,7 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len,
339 339
340 if (len) { 340 if (len) {
341 if (!access_ok(VERIFY_READ, src, len)) { 341 if (!access_ok(VERIFY_READ, src, len)) {
342 *errp = -EFAULT; 342 if (errp) *errp = -EFAULT;
343 memset(dst, 0, len); 343 memset(dst, 0, len);
344 return sum; 344 return sum;
345 } 345 }