All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "Sumit Semwal" <sumit.semwal@linaro.org>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Tony Luck" <tony.luck@intel.com>,
	"James Morse" <james.morse@arm.com>,
	"Robert Richter" <rric@kernel.org>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Christoph Lameter" <cl@linux.com>,
	"Pekka Enberg" <penberg@kernel.org>,
	"David Rientjes" <rientjes@google.com>,
	"Joonsoo Kim" <iamjoonsoo.kim@lge.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org,
	linux-edac@vger.kernel.org, linux-gpio@vger.kernel.org,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-mm@kvack.org,
	alsa-devel@alsa-project.org,
	"Bartosz Golaszewski" <bgolaszewski@baylibre.com>
Subject: Re: [PATCH 4/8] pinctrl: use krealloc_array()
Date: Tue, 27 Oct 2020 15:29:11 +0200	[thread overview]
Message-ID: <20201027132911.GX4077@smile.fi.intel.com> (raw)
In-Reply-To: <20201027121725.24660-5-brgl@bgdev.pl>

On Tue, Oct 27, 2020 at 01:17:21PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Use the helper that checks for overflows internally instead of manually
> calculating the size of the new array.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/pinctrl/pinctrl-utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-utils.c b/drivers/pinctrl/pinctrl-utils.c
> index f2bcbf62c03d..93df0d4c0a24 100644
> --- a/drivers/pinctrl/pinctrl-utils.c
> +++ b/drivers/pinctrl/pinctrl-utils.c
> @@ -39,7 +39,7 @@ int pinctrl_utils_reserve_map(struct pinctrl_dev *pctldev,
>  	if (old_num >= new_num)
>  		return 0;
>  
> -	new_map = krealloc(*map, sizeof(*new_map) * new_num, GFP_KERNEL);
> +	new_map = krealloc_array(*map, new_num, sizeof(*new_map), GFP_KERNEL);
>  	if (!new_map) {
>  		dev_err(pctldev->dev, "krealloc(map) failed\n");

...and here?

>  		return -ENOMEM;
> -- 
> 2.29.1
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-10-29 19:00 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 12:17 [PATCH 0/8] slab: provide and use krealloc_array() Bartosz Golaszewski
2020-10-27 12:17 ` Bartosz Golaszewski
2020-10-27 12:17 ` Bartosz Golaszewski
2020-10-27 12:17 ` [PATCH 1/8] mm: slab: provide krealloc_array() Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 18:20   ` Vlastimil Babka
2020-10-27 18:20     ` Vlastimil Babka
2020-10-27 18:20     ` Vlastimil Babka
2020-10-27 18:20     ` Vlastimil Babka
2020-10-28  8:47   ` Mike Rapoport
2020-10-28  8:47     ` Mike Rapoport
2020-10-28  8:47     ` Mike Rapoport
2020-10-27 12:17 ` [PATCH 2/8] ALSA: pcm: use krealloc_array() Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:39   ` Takashi Iwai
2020-10-27 12:39     ` Takashi Iwai
2020-10-27 12:39     ` Takashi Iwai
2020-10-27 12:17 ` [PATCH 3/8] vhost: vringh: " Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 15:28   ` Michael S. Tsirkin
2020-10-27 15:28     ` Michael S. Tsirkin
2020-10-27 15:28     ` Michael S. Tsirkin
2020-10-27 15:28     ` Michael S. Tsirkin
2020-10-27 16:50     ` Joe Perches
2020-10-27 16:50       ` Joe Perches
2020-10-27 16:50       ` Joe Perches
2020-10-27 16:50       ` Joe Perches
2020-10-27 16:58       ` Bartosz Golaszewski
2020-10-27 16:58         ` Bartosz Golaszewski
2020-10-27 16:58         ` Bartosz Golaszewski
2020-10-27 17:08         ` Joe Perches
2020-10-27 17:08           ` Joe Perches
2020-10-27 17:08           ` Joe Perches
2020-10-27 17:08           ` Joe Perches
2020-10-27 18:00           ` Bartosz Golaszewski
2020-10-27 18:00             ` Bartosz Golaszewski
2020-10-27 18:00             ` Bartosz Golaszewski
2020-10-27 12:17 ` [PATCH 4/8] pinctrl: " Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 13:29   ` Andy Shevchenko [this message]
2020-10-27 13:58     ` Andy Shevchenko
2020-10-27 12:17 ` [PATCH 5/8] edac: ghes: " Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 18:25   ` Borislav Petkov
2020-10-27 18:25     ` Borislav Petkov
2020-10-27 18:25     ` Borislav Petkov
2020-10-27 18:25     ` Borislav Petkov
2020-10-27 12:17 ` [PATCH 6/8] drm: atomic: " Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 19:19   ` Daniel Vetter
2020-10-27 19:19     ` Daniel Vetter
2020-10-27 19:19     ` Daniel Vetter
2020-10-27 19:19     ` Daniel Vetter
2020-10-27 12:17 ` [PATCH 7/8] hwtracing: intel: " Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17 ` [PATCH 8/8] dma-buf: " Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:17   ` Bartosz Golaszewski
2020-10-27 12:21   ` Christian König
2020-10-27 12:21     ` Christian König
2020-10-27 12:21     ` Christian König
2020-10-27 12:21     ` Christian König
2020-11-05 10:52 ` [PATCH 0/8] slab: provide and " Linus Walleij
2020-11-05 10:52   ` Linus Walleij
2020-11-05 10:52   ` Linus Walleij
2020-11-05 10:52   ` Linus Walleij

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=20201027132911.GX4077@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=bp@alien8.de \
    --cc=brgl@bgdev.pl \
    --cc=christian.koenig@amd.com \
    --cc=cl@linux.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=james.morse@arm.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=perex@perex.cz \
    --cc=rientjes@google.com \
    --cc=rric@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tiwai@suse.com \
    --cc=tony.luck@intel.com \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux-foundation.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.