[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXQ2=xPSGxDsrprb_pXjkOaUi_YZ+8h65kdW+SYCseWoQ@mail.gmail.com>
Date: Thu, 15 Apr 2021 09:18:25 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Florent Revest <revest@...omium.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Yonghong Song <yhs@...com>, KP Singh <kpsingh@...nel.org>,
Brendan Jackman <jackmanb@...omium.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper
Hi Andrii,
On Thu, Apr 15, 2021 at 12:58 AM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
> On Wed, Apr 14, 2021 at 11:30 AM Florent Revest <revest@...omium.org> wrote:
> > On Wed, Apr 14, 2021 at 8:02 PM Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
> > > On Wed, Apr 14, 2021 at 9:41 AM Andrii Nakryiko
> > > <andrii.nakryiko@...il.com> wrote:
> > > > On Mon, Apr 12, 2021 at 8:38 AM Florent Revest <revest@...omium.org> wrote:
> > > > > + fmt = (char *)fmt_addr + fmt_map_off;
> > > > > +
> > > >
> > > > bot complained about lack of (long) cast before fmt_addr, please address
> > >
> > > (uintptr_t), I assume?
> >
> > (uintptr_t) seems more correct to me as well. However, I just had a
> > look at the rest of verifier.c and (long) casts are already used
> > pretty much everywhere whereas uintptr_t isn't used yet.
> > I'll send a v4 with a long cast for the sake of consistency with the
> > rest of the verifier.
>
> right, I don't care about long or uintptr_t, both are guaranteed to
> work, I just remember seeing a lot of code with (long) cast. I have no
> preference.
AFAIR, uintptr_t was introduced only in C99. Early Linux code predates that,
hence uses long, and this behavior was of course copied to new code.
Please use uintptr_t in new code.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists