public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine•com>
To: Dan Carpenter <dan.carpenter@linaro•org>
Cc: Gerrit Renker <gerrit@erg•abdn.ac.uk>,
	"David S. Miller" <davem@davemloft•net>,
	Eric Dumazet <edumazet@google•com>,
	Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
	dccp@vger•kernel.org, netdev@vger•kernel.org,
	kernel-janitors@vger•kernel.org
Subject: Re: [PATCH net] dccp: Allocate enough data in ccid_get_builtin_ccids()
Date: Thu, 27 Jul 2023 13:24:53 +0200	[thread overview]
Message-ID: <ZMJUBWEPY+QPYg8z@corigine.com> (raw)
In-Reply-To: <c962e03c-6091-483a-90f2-4db8afe5283a@kadam.mountain>

On Wed, Jul 26, 2023 at 04:45:03PM +0300, Dan Carpenter wrote:
> On Wed, Jul 26, 2023 at 03:00:37PM +0200, Simon Horman wrote:
> > On Wed, Jul 26, 2023 at 02:56:01PM +0200, Simon Horman wrote:
> > > On Wed, Jul 26, 2023 at 01:47:02PM +0300, Dan Carpenter wrote:
> > > > This is allocating the ARRAY_SIZE() instead of the number of bytes.  The
> > > > array size is 1 or 2 depending on the .config and it should allocate
> > > > 8 or 16 bytes instead.
> > > > 
> > > > Fixes: ddebc973c56b ("dccp: Lockless integration of CCID congestion-control plugins")
> > > > Signed-off-by: Dan Carpenter <dan.carpenter@linaro•org>
> > > 
> > > Reviewed-by: Simon Horman <simon.horman@corigine•com>
> > 
> > Sorry, I was a bit hasty there.
> > 
> > > > --- a/net/dccp/ccid.c
> > > > +++ b/net/dccp/ccid.c
> > > > @@ -48,7 +48,8 @@ bool ccid_support_check(u8 const *ccid_array, u8 array_len)
> > > >   */
> > > >  int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len)
> > > >  {
> > > > -       *ccid_array = kmalloc(ARRAY_SIZE(ccids), gfp_any());
> > > > +       *ccid_array = kmalloc_array(ARRAY_SIZE(ccids), sizeof(*ccid_array),
> > > > +                                   gfp_any());
> > 
> > The type of *ccid_array is u8.
> > But shouldn't this be something more like sizeof(struct ccid_operations)
> > or sizeof(ccids[0]) ?
> 
> Aw crud.  Actually the code is fine isn't it.  I thought it was saving
> pointers but actually it's saving char.  *Embarrassing*.

Yeah, looking at this with fresh eyes, I see that you are right.
Let's drop this one.

-- 
pw-bot: rejected


      reply	other threads:[~2023-07-27 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 10:47 [PATCH net] dccp: Allocate enough data in ccid_get_builtin_ccids() Dan Carpenter
2023-07-26 12:56 ` Simon Horman
2023-07-26 13:00   ` Simon Horman
2023-07-26 13:45     ` Dan Carpenter
2023-07-27 11:24       ` Simon Horman [this message]

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=ZMJUBWEPY+QPYg8z@corigine.com \
    --to=simon.horman@corigine$(echo .)com \
    --cc=dan.carpenter@linaro$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=dccp@vger$(echo .)kernel.org \
    --cc=edumazet@google$(echo .)com \
    --cc=gerrit@erg$(echo .)abdn.ac.uk \
    --cc=kernel-janitors@vger$(echo .)kernel.org \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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