Re: [PATCH v3] extensions: libxt_hashlimit: fix uint64_t printf formats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 29, 2017 at 02:18:51PM +0200, Alin Năstac wrote:
> On Mon, May 29, 2017 at 2:02 PM, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> > On Wed, May 24, 2017 at 09:13:58AM +0200, Alin Nastac wrote:
> >> From: Alin Nastac <alin.nastac@xxxxxxxxx>
> >>
> >> The remaining %llu formats are used for unsigned long long values.
> >
> > Hm, still problems here:
> >
> > libxt_hashlimit.c: In function ‘hashlimit_mt_print’:
> > libxt_hashlimit.c:739:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ [-Wformat=]   printf(" burst %"PRIu64, cfg->burst);
> >    printf(" burst %"PRIu64, cfg->burst);
> >    ^
> > libxt_hashlimit.c: In function ‘hashlimit_mt_save’:
> > libxt_hashlimit.c:849:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ [-Wformat=]
> >    printf(" --hashlimit-burst %"PRIu64, cfg->burst);
> 
> On second thought, seems that "%"PRIu64 is equivalent in your case
> with "%lu". Maybe it is better to replace all %"PRIu64" with %llu.
> After all, uint64_t is supposed to be unsigned long long on all
> architectures, isn't it so?

long unsigned int here is 64-bits. But it takes processor word size.

I'm inclined to think we should just cast the __u64 to uint64_t to
sort out this, and use PRIu64.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux