]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/surface: aggregator: Fix access of unaligned value
authorMaximilian Luz <luzmaximilian@gmail.com>
Thu, 11 Feb 2021 12:41:49 +0000 (13:41 +0100)
committerHans de Goede <hdegoede@redhat.com>
Thu, 11 Feb 2021 15:47:50 +0000 (16:47 +0100)
The raw message frame length is unaligned and explicitly marked as
little endian. It should not be accessed without the appropriate
accessor functions. Fix this.

Note that payload.len already contains the correct length after parsing
via sshp_parse_frame(), so we can simply use that instead.

Reported-by: kernel-test-robot <lkp@intel.com>
Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Acked-by: Mark Gross <mgross@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210211124149.2439007-1-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/surface/aggregator/ssh_packet_layer.c

index 583315db8b02716dd83e44505a6719faf92587df..15d96eac6811fc39a38f37bb7b860c33a082bdd4 100644 (file)
@@ -1774,7 +1774,7 @@ static size_t ssh_ptl_rx_eval(struct ssh_ptl *ptl, struct ssam_span *source)
                break;
        }
 
-       return aligned.ptr - source->ptr + SSH_MESSAGE_LENGTH(frame->len);
+       return aligned.ptr - source->ptr + SSH_MESSAGE_LENGTH(payload.len);
 }
 
 static int ssh_ptl_rx_threadfn(void *data)