summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-09-23 21:05:32 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2014-09-23 21:05:32 (GMT)
commitd19eff3acfd27dead12ff1f7255fbfea2d778cdb (patch)
treecc73fbbb1e34c5e8ea27362a788acdf510209d29 /drivers
parentf0eb4a24d43c13a4f3e8b7b04f3f06011614c933 (diff)
parentd26a7730b5874a5fa6779c62f4ad7c5065a94723 (diff)
downloadlinux-d19eff3acfd27dead12ff1f7255fbfea2d778cdb.tar.xz
Merge branch 'parisc-3.17-7' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc fixes from Helge Deller: "We avoid using -mfast-indirect-calls for 64bit kernel builds to prevent building an unbootable kernel due to latest gcc changes. In the pdc_stable/firmware-access driver we fix a few possible stack overflows and we now call secure_computing_strict() instead of secure_computing() which fixes upcoming SECCOMP patches in the for-next trees" * 'parisc-3.17-7' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Only use -mfast-indirect-calls option for 32-bit kernel builds parisc: pdc_stable.c: Avoid potential stack overflows parisc: pdc_stable.c: Cleaning up unnecessary use of memset in conjunction with strncpy parisc: ptrace: use secure_computing_strict()
Diffstat (limited to 'drivers')
-rw-r--r--drivers/parisc/pdc_stable.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 0f54ab6..3651c38 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -278,7 +278,7 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun
{
struct hardware_path hwpath;
unsigned short i;
- char in[count+1], *temp;
+ char in[64], *temp;
struct device *dev;
int ret;
@@ -286,8 +286,9 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun
return -EINVAL;
/* We'll use a local copy of buf */
- memset(in, 0, count+1);
+ count = min_t(size_t, count, sizeof(in)-1);
strncpy(in, buf, count);
+ in[count] = '\0';
/* Let's clean up the target. 0xff is a blank pattern */
memset(&hwpath, 0xff, sizeof(hwpath));
@@ -393,14 +394,15 @@ pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count
{
unsigned int layers[6]; /* device-specific info (ctlr#, unit#, ...) */
unsigned short i;
- char in[count+1], *temp;
+ char in[64], *temp;
if (!entry || !buf || !count)
return -EINVAL;
/* We'll use a local copy of buf */
- memset(in, 0, count+1);
+ count = min_t(size_t, count, sizeof(in)-1);
strncpy(in, buf, count);
+ in[count] = '\0';
/* Let's clean up the target. 0 is a blank pattern */
memset(&layers, 0, sizeof(layers));
@@ -755,7 +757,7 @@ static ssize_t pdcs_auto_write(struct kobject *kobj,
{
struct pdcspath_entry *pathentry;
unsigned char flags;
- char in[count+1], *temp;
+ char in[8], *temp;
char c;
if (!capable(CAP_SYS_ADMIN))
@@ -765,8 +767,9 @@ static ssize_t pdcs_auto_write(struct kobject *kobj,
return -EINVAL;
/* We'll use a local copy of buf */
- memset(in, 0, count+1);
+ count = min_t(size_t, count, sizeof(in)-1);
strncpy(in, buf, count);
+ in[count] = '\0';
/* Current flags are stored in primary boot path entry */
pathentry = &pdcspath_entry_primary;