From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] omapfb: Use devm_kcalloc() in vrfb_probe()
Date: Thu, 11 May 2017 14:27:19 +0000 [thread overview]
Message-ID: <1672837.1nPA5UjCzD@amdc3058> (raw)
In-Reply-To: <4a7b1751-4319-4bde-cf26-2de2a4096c68@users.sourceforge.net>
Hi,
On Wednesday, April 26, 2017 11:20:07 AM SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 26 Apr 2017 11:08:30 +0200
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "devm_kcalloc".
>
> * Replace the specification of a data structure by a pointer dereference
> to make the corresponding size determination a bit safer according to
> the Linux coding style convention.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/video/fbdev/omap2/omapfb/vrfb.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/video/fbdev/omap2/omapfb/vrfb.c b/drivers/video/fbdev/omap2/omapfb/vrfb.c
> index f346b02eee1d..54b51a7a290a 100644
> --- a/drivers/video/fbdev/omap2/omapfb/vrfb.c
> +++ b/drivers/video/fbdev/omap2/omapfb/vrfb.c
> @@ -358,11 +358,7 @@ static int __init vrfb_probe(struct platform_device *pdev)
> return PTR_ERR(vrfb_base);
>
> num_ctxs = pdev->num_resources - 1;
> -
> - ctxs = devm_kzalloc(&pdev->dev,
> - sizeof(struct vrfb_ctx) * num_ctxs,
> - GFP_KERNEL);
> -
> + ctxs = devm_kcalloc(&pdev->dev, num_ctxs, sizeof(*ctxs), GFP_KERNEL);
This change makes the resulting binary larger by 24 bytes (probably
because of the need to have an additional function argument) and
I don't see an improvement from a security POV (pdev->num_resources
is based on the size of static tables from arch/arm/mach-omap2/fb.c).
I'm sorry but I'm not applying this patch.
> if (!ctxs)
> return -ENOMEM;
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
next prev parent reply other threads:[~2017-05-11 14:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170426092018epcas4p343e69e32255faa796e7c55c3e89e40f2@epcas4p3.samsung.com>
2017-04-26 9:20 ` [PATCH] omapfb: Use devm_kcalloc() in vrfb_probe() SF Markus Elfring
2017-05-11 14:27 ` Bartlomiej Zolnierkiewicz [this message]
2017-05-11 15:22 ` Bartlomiej Zolnierkiewicz
2017-05-12 7:07 ` Geert Uytterhoeven
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=1672837.1nPA5UjCzD@amdc3058 \
--to=b.zolnierkie@samsung.com \
--cc=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tomi.valkeinen@ti.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