Skip to content

Commit a893435

Browse files
aloktiwagregkh
authored andcommitted
staging: nvec: Fix incorrect null termination of battery manufacturer
The battery manufacturer string was incorrectly null terminated using bat_model instead of bat_manu. This could result in an unintended write to the wrong field and potentially incorrect behavior. fixe the issue by correctly null terminating the bat_manu string. Fixes: 32890b9 ("Staging: initial version of the nvec driver") Signed-off-by: Alok Tiwari <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a713222 commit a893435

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/staging/nvec/nvec_power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static int nvec_power_bat_notifier(struct notifier_block *nb,
194194
break;
195195
case MANUFACTURER:
196196
memcpy(power->bat_manu, &res->plc, res->length - 2);
197-
power->bat_model[res->length - 2] = '\0';
197+
power->bat_manu[res->length - 2] = '\0';
198198
break;
199199
case MODEL:
200200
memcpy(power->bat_model, &res->plc, res->length - 2);

0 commit comments

Comments
 (0)