summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/panasonic-laptop.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-01-14 09:01:17 +0300
committerLen Brown <len.brown@intel.com>2009-04-04 07:43:02 +0400
commitba256b41bd58f0821c9c0e203982fb260f09bdeb (patch)
treed56f5fa22fa4d82318e4e611ab5285ba5c5a5c1d /drivers/platform/x86/panasonic-laptop.c
parentc542aadeb4700bc316834d862d52ba3d2664f13a (diff)
downloadlinux-ba256b41bd58f0821c9c0e203982fb260f09bdeb.tar.xz
panasonic-laptop: use snprintf with PAGE_SIZE in sysfs attributes
Instead of just sprintf() into the page-sized buffer provided by the sysfs/device_attribute API, we use snprintf with PAGE_SIZE as an additional safeguard. Signed-off-by: Martin Lucina <mato@kotelna.sk> Signed-off-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/panasonic-laptop.c')
-rw-r--r--drivers/platform/x86/panasonic-laptop.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index ecaca412a2a1..a5ce4bc202e3 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -367,7 +367,7 @@ static ssize_t show_numbatt(struct device *dev, struct device_attribute *attr,
if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf))
return -EIO;
- return sprintf(buf, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]);
+ return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]);
}
static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr,
@@ -379,7 +379,7 @@ static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr,
if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf))
return -EIO;
- return sprintf(buf, "%u\n", pcc->sinf[SINF_LCD_TYPE]);
+ return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]);
}
static ssize_t show_mute(struct device *dev, struct device_attribute *attr,
@@ -391,7 +391,7 @@ static ssize_t show_mute(struct device *dev, struct device_attribute *attr,
if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf))
return -EIO;
- return sprintf(buf, "%u\n", pcc->sinf[SINF_MUTE]);
+ return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]);
}
static ssize_t show_sticky(struct device *dev, struct device_attribute *attr,
@@ -403,7 +403,7 @@ static ssize_t show_sticky(struct device *dev, struct device_attribute *attr,
if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf))
return -EIO;
- return sprintf(buf, "%u\n", pcc->sinf[SINF_STICKY_KEY]);
+ return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]);
}
static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,