lkml.org 
[lkml]   [2021]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/7] buildid: Add method to get running kernel's build ID
From
Date
Quoting Stephen Boyd (2021-03-02 15:28:25)
> (HTML mail?)
>
> Quoting Andy Shevchenko (2021-03-01 15:33:06)
> >
> >
> > On Monday, March 1, 2021, Stephen Boyd <swboyd@chromium.org> wrote:
> > @@ -147,3 +158,31 @@ int build_id_parse(struct vm_area_struct *vma,
> > unsigned char *build_id,
> >         put_page(page);
> >         return ret;
> >  }
> > +
> > +static void build_id2hex(char *dst, const unsigned char *src, __u32 size)
> > +{
> > +       bin2hex(dst, src, size);
> > +       dst[2 * size] = '\0';
> > +}
> > +
> >
> >
> >
> > If you are so only printing this via printf(), just use %20phN. No need for a
> > separate function.
> >
>
> Makes sense. The downside is that we may have to calculate the build ID
> many times then by searching the notes section? Unless we can test the
> whole array very quickly for "not initialized" or stash another bool
> like "build_id_initialized". The kdump code would also need to take a
> printk format then. This seems better as is but let me know if you
> disagree strongly and I can change more code.

I am using memchr_inv() now to check for an all zero array. That seems
fairly cheap so I think it should be OK. We trade-off a small amount of
time for a few more bytes savings.

\
 
 \ /
  Last update: 2021-03-04 02:40    [W:0.271 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site