mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
EDAC: Don't allow empty DIMM labels
Updating dimm_label to an empty string does not make much sense. Change the sysfs dimm_label store operation to fail a request when an input string is empty. Suggested-by: Borislav Petkov <[email protected]> Signed-off-by: Toshi Kani <[email protected]> Cc: [email protected] Cc: Mauro Carvalho Chehab <[email protected]> Cc: Tony Luck <[email protected]> Cc: linux-edac <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Borislav Petkov <[email protected]>
This commit is contained in:
parent
438470b84c
commit
d0c9c93019
1 changed files with 2 additions and 2 deletions
|
|
@ -248,7 +248,7 @@ static ssize_t channel_dimm_label_store(struct device *dev,
|
|||
if (data[count - 1] == '\0' || data[count - 1] == '\n')
|
||||
copy_count -= 1;
|
||||
|
||||
if (copy_count >= sizeof(rank->dimm->label))
|
||||
if (copy_count == 0 || copy_count >= sizeof(rank->dimm->label))
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(rank->dimm->label, data, copy_count);
|
||||
|
|
@ -509,7 +509,7 @@ static ssize_t dimmdev_label_store(struct device *dev,
|
|||
if (data[count - 1] == '\0' || data[count - 1] == '\n')
|
||||
copy_count -= 1;
|
||||
|
||||
if (copy_count >= sizeof(dimm->label))
|
||||
if (copy_count == 0 || copy_count >= sizeof(dimm->label))
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(dimm->label, data, copy_count);
|
||||
|
|
|
|||
Loading…
Reference in a new issue