netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "zhudi (J)" <zhudi21@huawei.com>
Cc: Michal Kubecek <mkubecek@suse.cz>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Chenxiang (EulerOS)" <rose.chen@huawei.com>
Subject: Re: [PATCH] rtnetlink: fix data overflow in rtnl_calcit()
Date: Mon, 19 Oct 2020 10:15:55 -0700	[thread overview]
Message-ID: <20201019101555.64b9f723@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <0DCA8173C37AD8458D6BA40EB0C660918CA689@DGGEMI532-MBX.china.huawei.com>

On Mon, 19 Oct 2020 01:59:19 +0000 zhudi (J) wrote:
> > zhudi, why not use size_t? Seems like the most natural fit for counting size.  
> 
> Thanks for your replying.
> min_dump_alloc original type used is u16 and it's eventually assigned to 
> struct netlink_callback{}. min_dump_alloc which data type is u32. So I just simply
> promote to u32.
> Should be used size_t instead of u32?

I had a closer look, and I agree that u32 should be fine in struct
netlink_dump_control, rtnetlink_rcv_msg(), and as a return value from
rtnl_calcit().

But please use size_t for the local variable in rtnl_calcit().
This way you can convert the max_t() to a max().

When you send v2 please move the declaration of min_ifinfo_dump_size
after struct net *net = sock_net(skb->sk); (to get closer to longest 
to shortest declaration order).

  reply	other threads:[~2020-10-19 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19  1:59 [PATCH] rtnetlink: fix data overflow in rtnl_calcit() zhudi (J)
2020-10-19 17:15 ` Jakub Kicinski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-10-19  1:09 zhudi (J)
2020-10-16  2:02 zhudi
2020-10-16 21:36 ` Jesse Brandeburg
2020-10-16 22:45   ` Vladimir Oltean
2020-10-17  0:44     ` Jesse Brandeburg
2020-10-17 12:34 ` Michal Kubecek
2020-10-18 18:41   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201019101555.64b9f723@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=rose.chen@huawei.com \
    --cc=zhudi21@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).