From: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
To: andy@kernel.org, hansg@kernel.org, mchehab@kernel.org,
sakari.ailus@linux.intel.com, gregkh@linuxfoundation.org,
feng@innora.ai
Cc: ~lkcamp/patches@lists.sr.ht,
linux-kernel-mentees@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: [PATCH v4 0/3] staging: media: atomisp: use kvmalloc_objs() and drop redundant OOM messages
Date: Tue, 14 Jul 2026 19:48:59 -0300 [thread overview]
Message-ID: <20260714225235.47134-1-rodrigo.gobbi.7@gmail.com> (raw)
Several allocations in the atomisp driver still size their buffers with
open-coded multiplication, e.g. width * height * sizeof(*p). When the
dimensions are large the product can silently wrap, causing kvmalloc()
to allocate an undersized buffer.
Convert the remaining sites to kvmalloc_objs() with array_size(), which
saturate to SIZE_MAX on overflow so kvmalloc() returns NULL instead of
allocating too few bytes.
This continues the work started in commit [2], and picks up the stalled
sites from [1], unifying with [3].
While here, drop the redundant IA_CSS_ERROR("out of memory") messages on
the touched allocation paths: the memory management core already emits a
far more detailed warning on allocation failure as raised at [1].
[1] https://lore.kernel.org/all/20260413112904.98864-1-feng@innora.ai/
[2] d178c7ca8fef ("staging: media: atomisp: use array3_size() for overflow-safe allocation")
[3] https://lore.kernel.org/all/20260609215110.118860-1-rodrigo.gobbi.7@gmail.com/
---
Changelog:
v4: 0002: use the full commit reference form for d178c7ca8fef (Media CI checkpatch); collect Andy's Reviewed-by;
v3: https://lore.kernel.org/all/20260623221028.40238-1-rodrigo.gobbi.7@gmail.com/#t
v2: https://lore.kernel.org/all/20260622224402.34001-1-rodrigo.gobbi.7@gmail.com/
v1: https://lore.kernel.org/all/20260609215110.118860-1-rodrigo.gobbi.7@gmail.com/
Feng Ning (1):
staging: media: atomisp: use kvmalloc_objs() for overflow-safe
allocation
Rodrigo Gobbi (2):
staging: media: atomisp: use kvmalloc_objs() in make_histogram()
staging: media: atomisp: drop redundant out-of-memory messages
.../media/atomisp/pci/sh_css_metrics.c | 11 +-
.../media/atomisp/pci/sh_css_param_dvs.c | 5 -
.../staging/media/atomisp/pci/sh_css_params.c | 101 +++++++-----------
3 files changed, 41 insertions(+), 76 deletions(-)
--
2.48.1
next reply other threads:[~2026-07-14 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 22:48 Rodrigo Gobbi [this message]
2026-07-14 22:49 ` [PATCH v4 1/3] staging: media: atomisp: use kvmalloc_objs() in make_histogram() Rodrigo Gobbi
2026-07-14 22:49 ` [PATCH v4 2/3] staging: media: atomisp: use kvmalloc_objs() for overflow-safe allocation Rodrigo Gobbi
2026-07-14 22:49 ` [PATCH v4 3/3] staging: media: atomisp: drop redundant out-of-memory messages Rodrigo Gobbi
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=20260714225235.47134-1-rodrigo.gobbi.7@gmail.com \
--to=rodrigo.gobbi.7@gmail.com \
--cc=andy@kernel.org \
--cc=feng@innora.ai \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=~lkcamp/patches@lists.sr.ht \
/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