* slab_ksize() and friends size_t -> unsigned int?
@ 2018-04-07 5:06 Kees Cook
2018-04-07 10:23 ` Alexey Dobriyan
0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2018-04-07 5:06 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Linux-MM
Hi,
I saw all the other int and size_t conversions to unsigned int. What
about ksize(), slab_ksize() and related functions too? It looks like
many callers are already expecting unsigned int anyway...
net/core/skbuff.c: unsigned int size = frag_size ? : ksize(data);
Though some are "int", ew:
int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
gfp_t gfp_mask)
{
int i, osize = skb_end_offset(skb);
int size = osize + nhead + ntail;
...
size = SKB_WITH_OVERHEAD(ksize(data));
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: slab_ksize() and friends size_t -> unsigned int?
2018-04-07 5:06 slab_ksize() and friends size_t -> unsigned int? Kees Cook
@ 2018-04-07 10:23 ` Alexey Dobriyan
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2018-04-07 10:23 UTC (permalink / raw)
To: Kees Cook; +Cc: Linux-MM
On Fri, Apr 06, 2018 at 10:06:31PM -0700, Kees Cook wrote:
> I saw all the other int and size_t conversions to unsigned int. What
> about ksize(), slab_ksize() and related functions too? It looks like
> many callers are already expecting unsigned int anyway...
>
> net/core/skbuff.c: unsigned int size = frag_size ? : ksize(data);
>
> Though some are "int", ew:
>
> int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
> gfp_t gfp_mask)
> {
> int i, osize = skb_end_offset(skb);
> int size = osize + nhead + ntail;
> ...
> size = SKB_WITH_OVERHEAD(ksize(data));
slab_ksize() can be changed.
As for ksize(). That path through page allocator is scary.
SLAB can be made unsigned int as well.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-07 10:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-07 5:06 slab_ksize() and friends size_t -> unsigned int? Kees Cook
2018-04-07 10:23 ` Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).