[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YCUrb+yAdBCagxvv@smile.fi.intel.com>
Date: Thu, 11 Feb 2021 15:04:47 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Maximilian Luz <luzmaximilian@...il.com>
Cc: Hans de Goede <hdegoede@...hat.com>,
Mark Gross <mgross@...ux.intel.com>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-test-robot <lkp@...el.com>
Subject: Re: [PATCH] platform/surface: aggregator: Fix access of unaligned
value
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
Powered by blists - more mailing lists