X86 platform drivers
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Maximilian Luz <luzmaximilian@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Mark Gross <mgross@linx.intel.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-test-robot <lkp@intel.com>
Subject: Re: [PATCH v2] platform/surface: aggregator: Fix access of unaligned value
Date: Thu, 11 Feb 2021 15:06:08 +0200	[thread overview]
Message-ID: <YCUrwLsQEqUzr267@smile.fi.intel.com> (raw)
In-Reply-To: <20210211124149.2439007-1-luzmaximilian@gmail.com>

On Thu, Feb 11, 2021 at 01:41:49PM +0100, Maximilian Luz wrote:
> 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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Reported-by: kernel-test-robot <lkp@intel.com>
> Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
> Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
> ---
> 
> Changes in v2:
>  - Use payload.len instead of getting the frame length directly. Note
>    that payload.len equals the frame length and is already correctly set
>    in sshp_parse_frame(), so they are exactly the same thing. Makes it
>    look a bit nicer though.
> 
>    I did drop the ACKs/Reveiewd-by in case you want to check that
>    yourselves and since that's essentially the whole change.
> 
> ---
>  drivers/platform/surface/aggregator/ssh_packet_layer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/surface/aggregator/ssh_packet_layer.c b/drivers/platform/surface/aggregator/ssh_packet_layer.c
> index 583315db8b02..15d96eac6811 100644
> --- a/drivers/platform/surface/aggregator/ssh_packet_layer.c
> +++ b/drivers/platform/surface/aggregator/ssh_packet_layer.c
> @@ -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)
> -- 
> 2.30.0
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-02-11 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 12:41 [PATCH v2] platform/surface: aggregator: Fix access of unaligned value Maximilian Luz
2021-02-11 13:06 ` Andy Shevchenko [this message]
2021-02-11 15:50 ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YCUrwLsQEqUzr267@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=luzmaximilian@gmail.com \
    --cc=mgross@linx.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox