linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	gregkh@linuxfoundation.org, linus.walleij@linaro.org,
	mika.westerberg@linux.intel.com, broonie@kernel.org,
	pierre-louis.bossart@linux.dev, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	linux-sound@vger.kernel.org
Subject: Re: [PATCH v1 1/5] devres: Introduce devm_kmemdup_array()
Date: Mon, 25 Nov 2024 17:08:13 +0200	[thread overview]
Message-ID: <Z0SS3cO4acfgz0iQ@black.fi.intel.com> (raw)
In-Reply-To: <Z0QsAm3FdZDJ8kY0@smile.fi.intel.com>

On Mon, Nov 25, 2024 at 09:49:22AM +0200, Andy Shevchenko wrote:
> On Sun, Nov 24, 2024 at 07:03:36AM +0000, Dmitry Torokhov wrote:
> > On Sun, Nov 24, 2024 at 01:35:23AM +0530, Raag Jadav wrote:
> > > Introduce '_array' variant of devm_kmemdup() for the users which lack
> > > multiplication overflow check.
> > 
> > I am not sure that this new helper is needed. Unlike allocators for
> > brand new objects, such as kmalloc_array(), devm_kmemdup() makes a copy
> > of already existing object, which is supposed to be a valid object and
> > therefore will have a reasonable size. So there should be no chance for
> > hitting this overflow unless the caller is completely confused and calls
> > devm_kmemdup() with random arguments (in which case all bets are off).
> 
> Don't we want to have a code more robust even if all what you say applies?
> Also this makes the call consistent with zillions of others from the alloc
> family of calls in the Linux kernel.

Agree. Although shooting in the foot is never the expectation, it is
atleast better than having to debug such unexpected cases.

Raag

  reply	other threads:[~2024-11-25 15:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-23 20:05 [PATCH v1 0/5] Introduce devm_kmemdup_array() helper Raag Jadav
2024-11-23 20:05 ` [PATCH v1 1/5] devres: Introduce devm_kmemdup_array() Raag Jadav
2024-11-24  7:03   ` Dmitry Torokhov
2024-11-25  7:49     ` Andy Shevchenko
2024-11-25 15:08       ` Raag Jadav [this message]
2024-11-25 16:29         ` Dmitry Torokhov
2024-11-25 17:13           ` Andy Shevchenko
2024-11-26  8:14             ` Raag Jadav
2024-11-23 20:05 ` [PATCH v1 2/5] pinctrl: intel: copy communities using devm_kmemdup_array() Raag Jadav
2024-11-23 20:05 ` [PATCH v1 3/5] pinctrl: pxa2xx: use devm_kmemdup_array() Raag Jadav
2024-11-23 20:05 ` [PATCH v1 4/5] input: sparse-keymap: " Raag Jadav
2024-11-23 20:05 ` [PATCH v1 5/5] ASoC: Intel: avs: " Raag Jadav
2024-11-25 17:21   ` Mark Brown

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=Z0SS3cO4acfgz0iQ@black.fi.intel.com \
    --to=raag.jadav@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).