public inbox for linux-kernel@vger.kernel.org
 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@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-test-robot <lkp@intel.com>
Subject: Re: [PATCH] platform/surface: aggregator: Fix access of unaligned value
Date: Thu, 11 Feb 2021 15:04:47 +0200	[thread overview]
Message-ID: <YCUrb+yAdBCagxvv@smile.fi.intel.com> (raw)
In-Reply-To: <b68b7547-5be4-c823-d015-febb5e7f84e9@gmail.com>

On Thu, Feb 11, 2021 at 12:58:48PM +0100, Maximilian Luz wrote:
> On 2/11/21 11:22 AM, Andy Shevchenko wrote:
> > On Thu, Feb 11, 2021 at 12:04:11AM +0100, Maximilian Luz wrote:
> > > The raw message frame length is unaligned and explicitly marked as
> > > little endian. It should not be accessed without the appropriatte
> > > accessor functions. Fix this.

...

> > Also it's possible to annotate temporary variable and use it, but it seems not
> > worth to do.
> 
> Now that you mention it, we already have the correct frame length in
> payload.len. Let me draft up a new patch with that.

Good!

> > Side question: Do you think the below is correct (& operator)?
> > 
> >          sp.len = get_unaligned_le16(&((struct ssh_frame *)sf.ptr)->len);
> > 
> > To me seems like you take an address to len member rather its value.
> 
> That's the point though, no? The signature is
> 
>         u16 get_unaligned_le16(const void *p)
> 
> so we do want a pointer to the len member. So I believe that is correct.

Indeed. I messed up with le16_to_cpu().

-- 
With Best Regards,
Andy Shevchenko



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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 23:04 [PATCH] platform/surface: aggregator: Fix access of unaligned value Maximilian Luz
2021-02-10 23:51 ` mark gross
2021-02-11 10:22 ` Andy Shevchenko
2021-02-11 11:58   ` Maximilian Luz
2021-02-11 13:04     ` Andy Shevchenko [this message]

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=YCUrb+yAdBCagxvv@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@linux.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