lkml.org 
[lkml]   [2022]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 1/1] vsprintf: Fix potential unaligned access
On Tue, Jan 11, 2022 at 12:54:41PM +0200, Sakari Ailus wrote:
> On Tue, Jan 11, 2022 at 12:10:28PM +0200, Andy Shevchenko wrote:
> > On Tue, Jan 11, 2022 at 12:12:46AM +0200, Sakari Ailus wrote:
> > > On Mon, Jan 10, 2022 at 10:50:49PM +0200, Andy Shevchenko wrote:
> > > > The %p4cc specifier in some cases might get an unaligned pointer.
> > > > Due to this we need to make copy to local variable once to avoid
> > > > potential crashes on some architectures due to improper access.
> > >
> > > I guess this problem exists virtually everywhere where pointers are being
> > > handled: the pointer could be unaligned.
> >
> > True. And my patch improves the situation.
> > See, for example, 0f70fe605fad ("hexdump: fix for non-aligned buffers").
>
> This is different since there's no guarantee of a void pointer's alignment.
>
> The pixelformat used for %p4cc is a pointer to u32.

Oh, look at the %p, compiler doesn't know about the %p extensions and caller
may supply whatever they want, i.e. %p may take any address that can be kept
in void *. Actual argument _is_ void *. What you put there as u32 is just
personal expectation, and not the reality.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-01-11 12:25    [W:0.053 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site