mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@csr.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Roel Kluin <roel.kluin@gmail.com>,
	linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] wusb: Use sizeof struct rather than pointer
Date: Tue, 24 Nov 2009 02:22:26 +0000	[thread overview]
Message-ID: <4B0B4362.1020809@csr.com> (raw)
In-Reply-To: <20091123163745.60c719c7.akpm@linux-foundation.org>

Andrew Morton wrote:
> 
> But I wonder if the code will still work.  Because we then go on to do
> 
>         secd_size = le16_to_cpu(secd->wTotalLength);
>         secd = krealloc(secd, secd_size, GFP_KERNEL);
> 
> which implies (to me) that the thing we read from the device might
> indeed have been smaller than we expected, in which case the
> newly-fixed check will cause a failure.

We first read the security descriptor which tells use the total length 
of the security descriptor plus all the following encryption type 
descriptors.  Your revised patch is fine.

David

      reply	other threads:[~2009-11-24  2:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-21 18:51 Roel Kluin
2009-11-24  0:37 ` Andrew Morton
2009-11-24  2:22   ` David Vrabel [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=4B0B4362.1020809@csr.com \
    --to=david.vrabel@csr.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=roel.kluin@gmail.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

Powered by JetHome