Skip to content

Commit

Permalink
kmsan: handle serial I/O in libps2
Browse files Browse the repository at this point in the history
  • Loading branch information
ramosian-glider committed Oct 18, 2018
1 parent 449d4d3 commit 25d76c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/input/serio/libps2.c
Expand Up @@ -12,6 +12,7 @@
*/

#include <linux/delay.h>
#include <linux/kmsan-checks.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
Expand All @@ -34,6 +35,7 @@ static int ps2_do_sendbyte(struct ps2dev *ps2dev, u8 byte,
int error;

lockdep_assert_held(&ps2dev->serio->lock);
kmsan_check_memory(&byte, 1);

do {
ps2dev->nak = 1;
Expand Down Expand Up @@ -298,9 +300,11 @@ int __ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command)

serio_pause_rx(ps2dev->serio);

if (param)
if (param) {
for (i = 0; i < receive; i++)
param[i] = ps2dev->cmdbuf[(receive - 1) - i];
kmsan_unpoison_shadow(param, receive);
}

if (ps2dev->cmdcnt &&
(command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) {
Expand Down

0 comments on commit 25d76c3

Please sign in to comment.