Home Home > GIT Browse > SLE12-SP5-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2019-08-20 14:08:53 +0200
committerMichal Suchanek <msuchanek@suse.de>2019-08-20 14:12:24 +0200
commitfce6003d767fe21eb294b21da2d971f42be1a283 (patch)
tree7ef70bb8d449470527383c7ef2c722c4e305af5a
parent3804b6cc413a8aa95db01c7f438e2a504c285a1f (diff)
powerpc/fadump: use kstrtoint to handle sysfs store
(bsc#1146376). - Refresh patches.arch/powerpc-fadump-re-register-firmware-assisted-dump-if.patch. suse-commit: f2d253678e643e749c25560bf538b229e0e2560d
-rw-r--r--arch/powerpc/kernel/fadump.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 17aa0a3bf99f..bb5ab46f40dd 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1375,10 +1375,15 @@ static ssize_t fadump_release_memory_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
+ int input = -1;
+
if (!fw_dump.dump_active)
return -EPERM;
- if (buf[0] == '1') {
+ if (kstrtoint(buf, 0, &input))
+ return -EINVAL;
+
+ if (input == 1) {
/*
* Take away the '/proc/vmcore'. We are releasing the dump
* memory, hence it will not be valid anymore.
@@ -1412,21 +1417,25 @@ static ssize_t fadump_register_store(struct kobject *kobj,
const char *buf, size_t count)
{
int ret = 0;
+ int input = -1;
if (!fw_dump.fadump_enabled || fdm_active)
return -EPERM;
+ if (kstrtoint(buf, 0, &input))
+ return -EINVAL;
+
mutex_lock(&fadump_mutex);
- switch (buf[0]) {
- case '0':
+ switch (input) {
+ case 0:
if (fw_dump.dump_registered == 0) {
goto unlock_out;
}
/* Un-register Firmware-assisted dump */
fadump_unregister_dump(&fdm);
break;
- case '1':
+ case 1:
if (fw_dump.dump_registered == 1) {
/* Un-register Firmware-assisted dump */
fadump_unregister_dump(&fdm);