lkml.org 
[lkml]   [2022]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH v2 24/48] Input: libps2: mark data received in __ps2_command() as initialized
    From
    KMSAN does not know that the device initializes certain bytes in
    ps2dev->cmdbuf. Call kmsan_unpoison_memory() to explicitly mark them as
    initialized.

    Signed-off-by: Alexander Potapenko <glider@google.com>
    ---
    Link: https://linux-review.googlesource.com/id/I2d26f6baa45271d37320d3f4a528c39cb7e545f0
    ---
    drivers/input/serio/libps2.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
    index 250e213cc80c6..3e19344eda93c 100644
    --- a/drivers/input/serio/libps2.c
    +++ b/drivers/input/serio/libps2.c
    @@ -12,6 +12,7 @@
    #include <linux/sched.h>
    #include <linux/interrupt.h>
    #include <linux/input.h>
    +#include <linux/kmsan-checks.h>
    #include <linux/serio.h>
    #include <linux/i8042.h>
    #include <linux/libps2.h>
    @@ -294,9 +295,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_memory(param, receive);
    + }

    if (ps2dev->cmdcnt &&
    (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) {
    --
    2.35.1.1021.g381101b075-goog
    \
     
     \ /
      Last update: 2022-03-29 14:43    [W:4.022 / U:0.180 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site