From: Clemens Ladisch <clemens@ladisch.de>
To: Andrey Borzenkov <arvidjaar@mail.ru>
Cc: Ira Snyder <iws@ovro.caltech.edu>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware: speed up request_firmware()
Date: Mon, 06 Apr 2009 10:43:28 +0200 [thread overview]
Message-ID: <49D9C0B0.1060905@ladisch.de> (raw)
In-Reply-To: <200904032125.28803.arvidjaar@mail.ru>
Andrey Borzenkov wrote:
> On Friday 03 of April 2009 10:46:11 Clemens Ladisch wrote:
> > Well, userspace does know the actual size of the image, so I see no
> > reason why it shouldn't be able to tell the kernel about it
> > beforehand.
>
> Right; but it will need some time for user space to catch up.
It's only an optimization.
> > @@ -46,6 +46,7 @@ struct firmware_priv {
> > struct firmware *fw;
> > unsigned long status;
> > int alloc_size;
> > + int size_hint;
>
> Unsigned?
It is as signed as alloc_size. ;-)
Yes, all these variables probably should be size_t.
> > +static ssize_t firmware_data_size_show(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > + struct firmware_priv *fw_priv = dev_get_drvdata(dev);
> > +
> > + return sprintf(buf, "%d\n", fw_priv->size_hint);
> > +}
>
> Why would you need it?
Good question. Apparently, for the same reason why we'd need
firmware_data_read ...
> > +static ssize_t firmware_data_size_store(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf, size_t count)
> > +{
> > + struct firmware_priv *fw_priv = dev_get_drvdata(dev);
> > + long value;
> > + int err;
> > +
> > + err = strict_strtol(buf, 10, &value);
> > + if (err)
> > + return err;
> > + fw_priv->size_hint = value;
>
> Should not there be some protection against using silly large values?
It is already possible to do "cat /dev/zero > .../data". What we'd need
is a limit not only on this variable but on the size of the firmware
image itself.
Okay, I'll do a bunch of patches to fix these warts in the firmware
loader.
Best regards,
Clemens
next prev parent reply other threads:[~2009-04-06 8:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 18:04 [PATCH] firmware: speed up request_firmware() Ira Snyder
2009-01-28 18:11 ` Alan Cox
2009-01-28 18:35 ` Matt Mackall
2009-01-28 19:03 ` Andrey Borzenkov
2009-01-28 19:45 ` Alan Cox
2009-01-28 20:34 ` Ira Snyder
2009-04-03 6:46 ` Clemens Ladisch
2009-04-03 17:25 ` Andrey Borzenkov
2009-04-06 8:43 ` Clemens Ladisch [this message]
2009-04-09 19:08 ` David Woodhouse
2009-04-10 5:03 ` David Woodhouse
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=49D9C0B0.1060905@ladisch.de \
--to=clemens@ladisch.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arvidjaar@mail.ru \
--cc=iws@ovro.caltech.edu \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.