powerpc/pseries: lparcfg - fix kbuf[] underflow
Subsystems (2)
PATCH 1/1 powerpc/pseries: lparcfg - fix kbuf[] underflow
In lparcfg_write(), a count of 0 results in kbuf[] being indexed at -1. Check for count == 0 in the existing check for count > sizeof(kbuf) and return -EINVAL if true.
Fixes 74422e2b1939 ("powerpc/pseries: Remove VLA from lparcfg_write()")
Acked-by Nayna Jain <[email protected]>
Tested-by R Nageswara Sastry <[email protected]>
Cc [email protected] # 4.20
Signed-off-by George Wilson <[email protected]>
--- arch/powerpc/platforms/pseries/lparcfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/lparcfg.c +1 -1
@@ -697,7 +697,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,if (!firmware_has_feature (FW_FEATURE_SPLPAR ))return -EINVAL ; -if (count >sizeof (kbuf)) +if (count ==0 || count >sizeof (kbuf))return -EINVAL ;if (copy_from_user (kbuf, buf, count))
Signature · 1 line
2.47.3