lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y43vN2cxlSERMh2/@kernel.org>
Date:   Mon, 5 Dec 2022 10:16:39 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Ian Rogers <irogers@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Leo Yan <leo.yan@...aro.org>,
        Kan Liang <kan.liang@...ux.intel.com>,
        linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v2 2/4] perf util: Add host_is_bigendian to util.h

Em Wed, Nov 30, 2022 at 10:52:35AM -0800, Namhyung Kim escreveu:
> On Tue, Nov 29, 2022 at 10:30 PM Ian Rogers <irogers@...gle.com> wrote:
> >
> > Avoid libtraceevent dependency for tep_is_bigendian or trace-event.h
> > dependency for bigendian. Add a new host_is_bigendian to util.h, using
> > the compiler defined __BYTE_ORDER__ when available.
> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> 
> Acked-by: Namhyung Kim <namhyung@...nel.org>
> 
> A nit below...
> 
> > ---
> [SNIP]
> > diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> > index 63cdab0e5314..87d418cb6792 100644
> > --- a/tools/perf/util/util.h
> > +++ b/tools/perf/util/util.h
> > @@ -94,4 +94,23 @@ int do_realloc_array_as_needed(void **arr, size_t *arr_sz, size_t x,
> >                 0;                                              \
> >         })
> >
> > +static inline bool host_is_bigendian(void)
> > +{
> > +#ifdef __BYTE_ORDER__
> > +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> > +       return false;
> > +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> > +       return true;
> > +#else
> > +#error "Unrecognized __BYTE_ORDER__"
> > +#endif
> > +#else
> 
> It'd be nice if we could have a comment at least there's a nested
> ifdef condition.  Like below?
> 
> #else  /* !__BYTE_ORDER__ */

Reasonable, added it and applied the first two patches in this series,
with your Acked-by, thanks.

- Arnaldo


diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 87d418cb67929576..a06c54ab85ee4506 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -104,7 +104,7 @@ static inline bool host_is_bigendian(void)
 #else
 #error "Unrecognized __BYTE_ORDER__"
 #endif
-#else
+#else /* !__BYTE_ORDER__ */
 	unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0};
 	unsigned int *ptr;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ