From nobody Sat Jul 25 18:53:41 2026 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EB6D42BEAF for ; Tue, 14 Jul 2026 22:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784069569; cv=none; b=tIwQm+OdY2w/21adkeZxT046B3rsYpl/ZreiI95qriakrgeqseRS8fcNE5aS85FU2Ipsh+150cwu2JujWGwDHwJ8lBZR9wpPJcJKydtGF1lWX6CiLiHM/2dHzIi4pWUNFGBY7l0cWFbXhT2cg0q3NQRkVcPO7odGqPykLrbCNqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784069569; c=relaxed/simple; bh=A/qCooa4CX/pAneYM+GM5KmJMW5XYUBE0lCmM9t6q+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i9rBzftZlzghl2zYTZMWsUTTExvOfowPUpLt4R2+Dfqx9DPkq3WJHU++11f84OyoG3i9HIrO5om0M++h3FYP+B8CKQvr5LDFN1r31C9nSG5NBwmctZykbNg0MmYte+dCb0G8Ba9UTFw6lJ2naOWrDtR8nrBxLFYprIkyKcqkNSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dxaHtciJ; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dxaHtciJ" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-80cebd41372so48153947b3.3 for ; Tue, 14 Jul 2026 15:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784069567; x=1784674367; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=U/WWXOiE2bPExBcg+mH0smayeiXsP/dreEIzKLTojxg=; b=dxaHtciJTDJxOVpqIj1cpS9eX3H38lWeU6h8h1FXxTouRE6FLJErBWGXIWIGUM3XcX VesQMQQW9N2F7MtykoDphNTj0i+v1jPdR5nTT/jURH9m1AFZcPfL08UNE6+PlQCAC9lZ 2G+wcfzlJ1spVh66yzm3MHXXQALtqMyeAmnvHaL99/I6Zw0dP3AlsxIJBjittZHhW10J D9T8ncDgTTrvJCcYsTj/HHKlnbvqSAstXc7I4Z1MKwJMESNtoLYkG1dYir7OesHG2D7d hKMAKKugHDOzyNM6YHUdGkuCxfxEuvVB8fw86Ks8EpRnoNFabJs7mGiPwb8DHbZklZ3b OTrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784069567; x=1784674367; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=U/WWXOiE2bPExBcg+mH0smayeiXsP/dreEIzKLTojxg=; b=dhdhbVq/7dJhz6ZdHk/NuW/oTVghm63LEhqWRbZzUluI/gp3Q118PuoIiyoMtlSxYF DkHrVEnWOg5fqkfaCo7yJq8vj8V6Rbgp/KlmN+IzSU1kt0mdCJmp4z7asVz9lvfBF5yu 8veLTgpx6cUFKoPe+Nk8usEViG/VEa/NVi69x6J+Zv//jBGawADqL6enqOJ5TAgsLTSQ XJJvQYd5MTONu8vrAsX1Moa9eHv3gZ0HBbn7w8h11qn+zQoHfx9kYfrQbyh5t9qFsxgU IPz+/xDlxoBb/GqF13ve/EKMdlx03kldeZ6p72A1ybEFzkqM5ZrTDYIOZp+nPYvZDnIs 7RHw== X-Forwarded-Encrypted: i=1; AHgh+Ro9n728oWDpAm4BYL2S00lqc7YHhX2hRfMq1LhjpsAObUfxvjiFXgdu0qnyWRsOftVYibndEgOcsr3hzuY=@vger.kernel.org X-Gm-Message-State: AOJu0YxKI7fW2OC2S9d/sH73cjzp+VwYTe7MlNS7ysnkrLQHFoIq0qbp ky/IBwDQzTD8Eai82L9HF1LgWEumvgP36V5HJ47Wj+NQCC5woJ2CFARgteThjgvK X-Gm-Gg: AfdE7cnwnhWIT4e8TmX+gh4LPc8+xlSHq3BAtjkcj3vSz2MjFdxVK0SbbdB2aphf359 7moM7e+uyq9lZrMhq5KFLntsVSTbKcHLRJjfE8puchC6zQXMOXyxJV6mbQEr+2tjAwM1IdySW6s PSMecdshpuTKUFew+qRdlK9wNByusBwvc9LyyJqxIM44m72XJm7XuWCAjk/INzvJMr8Z+rjUt0G PiCBdlTJNWDOSECc0I2oy2NPmnqq/S2ppkvyWy5OjTgUDcZbMx5qDdTNH4CH0SHOaXHdvBpHodR /xaQvPZboLwjbdJ9JlXZEW93eFRqt2LMfTE/v0Q886P/Cdf2L0njAjEJZQmC6cC9Gl+aMwanBi1 zXphmn2mnpCfVT/YBJ+tMVLO4u+JsEM39zaMmNvMjr5bkdkkTVEXHDzAiTNpfQ+JAsEEeNXELXa bpMaXKwucCyk34jYjlPT1lchaY9aq2Oq6Y7S3Y7QW0LUN+pldXSpzG1kyu7yuLzHdC5Comm3b/J 8sw X-Received: by 2002:a05:690c:6b86:b0:81d:2194:6c4a with SMTP id 00721157ae682-81ecfa39bdbmr4685007b3.47.1784069566934; Tue, 14 Jul 2026 15:52:46 -0700 (PDT) Received: from localhost.localdomain ([2804:14d:4c64:82a2:a510:f4e7:1a8:cf71]) by smtp.gmail.com with ESMTPSA id 00721157ae682-81e6c249b87sm153446897b3.49.2026.07.14.15.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 15:52:46 -0700 (PDT) From: Rodrigo Gobbi 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 1/3] staging: media: atomisp: use kvmalloc_objs() in make_histogram() Date: Tue, 14 Jul 2026 19:49:00 -0300 Message-ID: <20260714225235.47134-2-rodrigo.gobbi.7@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260714225235.47134-1-rodrigo.gobbi.7@gmail.com> References: <20260714225235.47134-1-rodrigo.gobbi.7@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace kvmalloc() with multiply with kvmalloc_objs(), which handles the size multiplication internally with overflow checking, silenting checkpatch warn. Signed-off-by: Rodrigo Gobbi Reviewed-by: Andy Shevchenko --- drivers/staging/media/atomisp/pci/sh_css_metrics.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_metrics.c b/drivers/s= taging/media/atomisp/pci/sh_css_metrics.c index edf473dd86ca..90d92ab8d52b 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_metrics.c +++ b/drivers/staging/media/atomisp/pci/sh_css_metrics.c @@ -4,6 +4,8 @@ * Copyright (c) 2015, Intel Corporation. */ =20 +#include + #include "assert_support.h" #include "sh_css_metrics.h" =20 @@ -59,16 +61,13 @@ make_histogram(struct sh_css_pc_histogram *histogram, u= nsigned int length) return; if (histogram->run) return; - histogram->run =3D kvmalloc(length * sizeof(*histogram->run), - GFP_KERNEL); + histogram->run =3D kvmalloc_objs(*histogram->run, length); if (!histogram->run) return; - histogram->stall =3D kvmalloc(length * sizeof(*histogram->stall), - GFP_KERNEL); + histogram->stall =3D kvmalloc_objs(*histogram->stall, length); if (!histogram->stall) return; - histogram->msink =3D kvmalloc(length * sizeof(*histogram->msink), - GFP_KERNEL); + histogram->msink =3D kvmalloc_objs(*histogram->msink, length); if (!histogram->msink) return; =20 --=20 2.48.1 From nobody Sat Jul 25 18:53:41 2026 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69E5741E6A3 for ; Tue, 14 Jul 2026 22:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784069575; cv=none; b=HXoXoqoW4XnLiM+o6yqq2e144zZm0IHgvs1uS60nt4H4Q8eVBE2oqh6hTwNoDe9awXhQ+TQ/KlbaDFUw86H5ArxjizfqWYTq2EbmCqra/xdZHuxcINjttqlgbdV0fQmmvkdL17zCbA9zU3S7pMiXHHA1YrBGnq9uVqGN6z8JCOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784069575; c=relaxed/simple; bh=5xD+gbAAQfa7Zz6DBWl8uQYu5cCVQd7fsutssEb695I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rwn7ZkeobK+s/ni2f88wjCbDIil9agCJvsdeRLWhj0uJH4rD9ERS8OcPjwJyozlnQJd4k16I2+Ry4nk00Xx5k5Tsmmp+3l9/DWiNloka/gc19rrFwEKu98TDMcm3agRl70TAoLEbr3auBLlg9VFIupe+AUkEpqemKqFLgir3AZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZnZ6ObtD; arc=none smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZnZ6ObtD" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-80c5cb9a888so43756107b3.3 for ; Tue, 14 Jul 2026 15:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784069571; x=1784674371; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fS/qYunkaEsTBnkedEsMK25XcSingk2GiGQfZYV0Pss=; b=ZnZ6ObtD6ZBmWSsddXaubVVfrwC7dJBnvvSEJoHBFG5J2kU4mSgU0ckp7NnQw1BBDc z0GWZ2G4E17xv8HxzNuwvMCQn4sKw3BQBeNc/RH+2Ed8TWt0BjdI1A2v97M9ump+TG7X CHk/ymoAPHUSPbggPZGui8ty9D9HucDp0Oz4H/JgRs1hPlapEu5/srheWPooXkynjCik MTvNhzSPpY9rZ7DGk4NoQGBm000Dg1+22js6LkBPrZU5B/91M9mavsAeV/y2o2YxFf3h gD+TVO1tIoK2oPFpyaAhJ+7Qh+OKPSRm5xUytitlv9j9DUf6XAJ5T/Wlw8Gh56cCRLJt VpBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784069571; x=1784674371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=fS/qYunkaEsTBnkedEsMK25XcSingk2GiGQfZYV0Pss=; b=plw1DS/oEtYEbkV7wys6fqOKl4v22UL5EE0FONika2sH21+aLWMSdrgNEp0l8Kn87i 4LORB5oFDNwTffdz35nnDi9h3ElyUwKCdglAaknv48ENwB7WpNMg09eUckT66/gwXz2q Z1BI7nZ8fv/iq1L/MFNDjNqFEnOjBpnV0V0KCUv6tpCO8Q1wp9tJpTosy6whcY+n38D/ betqaPTqZTDJ95w0CFni2htrr2HUc9GJek1fgEbs1vjD5qKqVTLcpq7XS0Ca01imo/g5 c7wPpmLIBJyZfsyGElNOnERS9ISrQP1zZQU85zwc/ligATVnlr4YxFrtMn98zPNSe/dQ oX/A== X-Forwarded-Encrypted: i=1; AHgh+RrB32h+RG/hqoswHieQoI6HtO5zgphmpuTfTOfRNLHvYhzYqUZI7sPwI3I8C1LHTegqw8yZ2Az3HVgTLak=@vger.kernel.org X-Gm-Message-State: AOJu0YyGnByX4N1ZQajRq1vcE6JBaFcGiFucAeCl+mWeGHGF0dkrLaCf Ml2dnq7UOimSbmkTQolZZgq3fpjyZ7VDDC+RmTATekf4Cr/G6bL43aOz X-Gm-Gg: AfdE7ckCtPCGbkcJUfXIZ3K7Z3iEfYPdh95LB9U0fd+REoEUlvm7bY0pNeaSNDAXXwx 7HXb5Vz1NU22FqnEIGtV9ISFPQ6bmXhobEejtrnU92KKbJld4garXj58BNNrkHHwCIvma2J6279 Lfr2k3DeqBgRxPxaiOAghhslPhDx8p4yKwdJhHxzmlMRcmCk7HszrLMueSOc4A4At8Q/4e7KTZb D7WkXQD0/QMoaMGaLelsD523EKnFeOvymQO1+/VoFnsA9sg/+W8gXnSS4o6gxieiKP4+ayu7gAW 9hXtB3KgiJFY7Cr/oZTs4OdfyamkwsH7rAAE92xKDCyUJfDpnnLetkGCK8slZGVMd26lsx/K+wi uklhJuh+pZogRcv+220DA3gfspE+mzrXHM5dU1coMcZr5XIaMN5s4Cv2+WgmhWzeHKRydazQww/ c41Dv7mJvjyqZUrG9NDMlFcfkN3NFk4iqGqNFIHx81sa0CBHao6Ri7ARsA2NqRegGnTQ== X-Received: by 2002:a05:690c:998b:b0:7fe:4069:d3fe with SMTP id 00721157ae682-81ebfdafedfmr30470587b3.30.1784069571383; Tue, 14 Jul 2026 15:52:51 -0700 (PDT) Received: from localhost.localdomain ([2804:14d:4c64:82a2:a510:f4e7:1a8:cf71]) by smtp.gmail.com with ESMTPSA id 00721157ae682-81e6c249b87sm153446897b3.49.2026.07.14.15.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 15:52:50 -0700 (PDT) From: Rodrigo Gobbi 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 2/3] staging: media: atomisp: use kvmalloc_objs() for overflow-safe allocation Date: Tue, 14 Jul 2026 19:49:01 -0300 Message-ID: <20260714225235.47134-3-rodrigo.gobbi.7@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260714225235.47134-1-rodrigo.gobbi.7@gmail.com> References: <20260714225235.47134-1-rodrigo.gobbi.7@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Feng Ning Replace open-coded width * height * sizeof() multiplications with kvmalloc_objs() and array_size() to prevent integer overflow in buffer allocations. The atomisp driver computes DVS and statistics buffer sizes using unchecked arithmetic. When dimensions are large, the product can silently wrap, causing kvmalloc() to allocate an undersized buffer. kvmalloc_objs() uses size_mul() internally, which saturates to SIZE_MAX on overflow, so kvmalloc() returns NULL instead of succeeding with too few bytes. array_size() provides the same overflow protection for the two-factor dimension products. Suggested-by: Andy Shevchenko Signed-off-by: Feng Ning [rodrigo: rebased; convert only the sites left open-coded after commit d178c7ca8fef ("staging: media: atomisp: use array3_size() for overflow-safe allocation")] Signed-off-by: Rodrigo Gobbi Reviewed-by: Andy Shevchenko --- .../staging/media/atomisp/pci/sh_css_params.c | 101 +++++++----------- 1 file changed, 36 insertions(+), 65 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/st= aging/media/atomisp/pci/sh_css_params.c index 8420a22fd8f0..adc329be8b0b 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -6,6 +6,7 @@ =20 #include #include +#include =20 #include "gdc_device.h" /* gdc_lut_store(), ... */ #include "isp.h" /* ISP_VEC_ELEMBITS */ @@ -4151,7 +4152,7 @@ struct ia_css_3a_statistics * ia_css_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid) { struct ia_css_3a_statistics *me; - int grid_size; + size_t grid_size; =20 IA_CSS_ENTER("grid=3D%p", grid); =20 @@ -4162,8 +4163,8 @@ ia_css_3a_statistics_allocate(const struct ia_css_3a_= grid_info *grid) goto err; =20 me->grid =3D *grid; - grid_size =3D grid->width * grid->height; - me->data =3D kvmalloc(grid_size * sizeof(*me->data), GFP_KERNEL); + grid_size =3D array_size(grid->width, grid->height); + me->data =3D kvmalloc_objs(*me->data, grid_size); if (!me->data) goto err; /* No weighted histogram, no structure, treat the histogram data as a byt= e dump in a byte array */ @@ -4236,6 +4237,7 @@ struct ia_css_dvs_coefficients * ia_css_dvs_coefficients_allocate(const struct ia_css_dvs_grid_info *grid) { struct ia_css_dvs_coefficients *me; + size_t cnt; =20 assert(grid); =20 @@ -4245,15 +4247,13 @@ ia_css_dvs_coefficients_allocate(const struct ia_cs= s_dvs_grid_info *grid) =20 me->grid =3D *grid; =20 - me->hor_coefs =3D kvmalloc(grid->num_hor_coefs * - IA_CSS_DVS_NUM_COEF_TYPES * - sizeof(*me->hor_coefs), GFP_KERNEL); + cnt =3D array_size(grid->num_hor_coefs, IA_CSS_DVS_NUM_COEF_TYPES); + me->hor_coefs =3D kvmalloc_objs(*me->hor_coefs, cnt); if (!me->hor_coefs) goto err; =20 - me->ver_coefs =3D kvmalloc(grid->num_ver_coefs * - IA_CSS_DVS_NUM_COEF_TYPES * - sizeof(*me->ver_coefs), GFP_KERNEL); + cnt =3D array_size(grid->num_ver_coefs, IA_CSS_DVS_NUM_COEF_TYPES); + me->ver_coefs =3D kvmalloc_objs(*me->ver_coefs, cnt); if (!me->ver_coefs) goto err; =20 @@ -4277,6 +4277,7 @@ struct ia_css_dvs2_statistics * ia_css_dvs2_statistics_allocate(const struct ia_css_dvs_grid_info *grid) { struct ia_css_dvs2_statistics *me; + size_t cnt; =20 assert(grid); =20 @@ -4286,59 +4287,37 @@ ia_css_dvs2_statistics_allocate(const struct ia_css= _dvs_grid_info *grid) =20 me->grid =3D *grid; =20 - me->hor_prod.odd_real =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->hor_prod.odd_real), - GFP_KERNEL); + cnt =3D array_size(grid->aligned_width, grid->aligned_height); + + me->hor_prod.odd_real =3D kvmalloc_objs(*me->hor_prod.odd_real, cnt); if (!me->hor_prod.odd_real) goto err; =20 - me->hor_prod.odd_imag =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->hor_prod.odd_imag), - GFP_KERNEL); + me->hor_prod.odd_imag =3D kvmalloc_objs(*me->hor_prod.odd_imag, cnt); if (!me->hor_prod.odd_imag) goto err; =20 - me->hor_prod.even_real =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->hor_prod.even_real), - GFP_KERNEL); + me->hor_prod.even_real =3D kvmalloc_objs(*me->hor_prod.even_real, cnt); if (!me->hor_prod.even_real) goto err; =20 - me->hor_prod.even_imag =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->hor_prod.even_imag), - GFP_KERNEL); + me->hor_prod.even_imag =3D kvmalloc_objs(*me->hor_prod.even_imag, cnt); if (!me->hor_prod.even_imag) goto err; =20 - me->ver_prod.odd_real =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->ver_prod.odd_real), - GFP_KERNEL); + me->ver_prod.odd_real =3D kvmalloc_objs(*me->ver_prod.odd_real, cnt); if (!me->ver_prod.odd_real) goto err; =20 - me->ver_prod.odd_imag =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->ver_prod.odd_imag), - GFP_KERNEL); + me->ver_prod.odd_imag =3D kvmalloc_objs(*me->ver_prod.odd_imag, cnt); if (!me->ver_prod.odd_imag) goto err; =20 - me->ver_prod.even_real =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->ver_prod.even_real), - GFP_KERNEL); + me->ver_prod.even_real =3D kvmalloc_objs(*me->ver_prod.even_real, cnt); if (!me->ver_prod.even_real) goto err; =20 - me->ver_prod.even_imag =3D kvmalloc(grid->aligned_width * - grid->aligned_height * - sizeof(*me->ver_prod.even_imag), - GFP_KERNEL); + me->ver_prod.even_imag =3D kvmalloc_objs(*me->ver_prod.even_imag, cnt); if (!me->ver_prod.even_imag) goto err; =20 @@ -4377,51 +4356,43 @@ ia_css_dvs2_coefficients_allocate(const struct ia_c= ss_dvs_grid_info *grid) =20 me->grid =3D *grid; =20 - me->hor_coefs.odd_real =3D kvmalloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.odd_real), - GFP_KERNEL); + me->hor_coefs.odd_real =3D kvmalloc_objs(*me->hor_coefs.odd_real, + grid->num_hor_coefs); if (!me->hor_coefs.odd_real) goto err; =20 - me->hor_coefs.odd_imag =3D kvmalloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.odd_imag), - GFP_KERNEL); + me->hor_coefs.odd_imag =3D kvmalloc_objs(*me->hor_coefs.odd_imag, + grid->num_hor_coefs); if (!me->hor_coefs.odd_imag) goto err; =20 - me->hor_coefs.even_real =3D kvmalloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.even_real), - GFP_KERNEL); + me->hor_coefs.even_real =3D kvmalloc_objs(*me->hor_coefs.even_real, + grid->num_hor_coefs); if (!me->hor_coefs.even_real) goto err; =20 - me->hor_coefs.even_imag =3D kvmalloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.even_imag), - GFP_KERNEL); + me->hor_coefs.even_imag =3D kvmalloc_objs(*me->hor_coefs.even_imag, + grid->num_hor_coefs); if (!me->hor_coefs.even_imag) goto err; =20 - me->ver_coefs.odd_real =3D kvmalloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.odd_real), - GFP_KERNEL); + me->ver_coefs.odd_real =3D kvmalloc_objs(*me->ver_coefs.odd_real, + grid->num_ver_coefs); if (!me->ver_coefs.odd_real) goto err; =20 - me->ver_coefs.odd_imag =3D kvmalloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.odd_imag), - GFP_KERNEL); + me->ver_coefs.odd_imag =3D kvmalloc_objs(*me->ver_coefs.odd_imag, + grid->num_ver_coefs); if (!me->ver_coefs.odd_imag) goto err; =20 - me->ver_coefs.even_real =3D kvmalloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.even_real), - GFP_KERNEL); + me->ver_coefs.even_real =3D kvmalloc_objs(*me->ver_coefs.even_real, + grid->num_ver_coefs); if (!me->ver_coefs.even_real) goto err; =20 - me->ver_coefs.even_imag =3D kvmalloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.even_imag), - GFP_KERNEL); + me->ver_coefs.even_imag =3D kvmalloc_objs(*me->ver_coefs.even_imag, + grid->num_ver_coefs); if (!me->ver_coefs.even_imag) goto err; =20 --=20 2.48.1 From nobody Sat Jul 25 18:53:41 2026 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EB29431E47 for ; Tue, 14 Jul 2026 22:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784069577; cv=none; b=RGsWIwOORYTckpFONCs75+/7/u/7baz9UMn7WiwGMLTswKX/a+ctSCO41yrVBQUhl/bxpUGgL71jCX55cN3rdxdgCsSkRigUx/O2A8xhj6nbWc1mBvj2lTlOrPI8iJ8D1tR1MwnjLS6oEPCfkwxDXnUiwRKLfiNd78dPtJFm8Nw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784069577; c=relaxed/simple; bh=aneHEOEVTUFpxhruqbXN4fpzumP0voPWx/etkXlO+EI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nMKUx8Vy1Q4H+F/CNHklNKzbml4FWZ1LFYp3CJijlQ4bPOGSO7J5JhAo3ndtDGrQM+e8sjSfTPs1I/oeQ3LDmfn4op6bxczbDl3XoV21k1xwioSq0pge3ZeSdEHyAjmDThhq1nJzEAOJkpj9F1JTAKM6zspE/+z1ylvXZuY8lfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kOEzYcyk; arc=none smtp.client-ip=209.85.128.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kOEzYcyk" Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-81ecf499af9so2218597b3.1 for ; Tue, 14 Jul 2026 15:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784069575; x=1784674375; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=huMAZLasX9MtSdlliVLSBQtahcShQoIS8BrLCB4qkoo=; b=kOEzYcykoVyyRJeDaA1L2sOv0jypIWaIjwBBfJAeZCILPC471LO6URqOm5pIHVamV9 InKXPd5n9tq0p0+fWN4XxbMU+uGB0YkX21BaqO60rUokUrRdXn3DkHBDeUlJcSFeZrZT 9vbyGy+o8yNoAm8R9fs2uwPqcLHm2BfjvFymPnTN3K90qiP99WLfeMSUUTvAw2aAru1L MIc++u+5ZYcgrXRsdABwcHMl5Kx4nZmDLeRafOhfvHvuAAtP63JT6bDGMmBTQPNR+x+j Xa4nnWBxKM/cs+8M7P8FhOUtiTvvOSHpfd7Uvvg0mxV1pnJQuENRAv+qJDko4KgKCcK4 7rdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784069575; x=1784674375; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=huMAZLasX9MtSdlliVLSBQtahcShQoIS8BrLCB4qkoo=; b=F+AusiU9Vu1BmZgJFVEzkbb7lejgBjgJtc4epQ38oR/nQ5daoYU1n5qnywbyTYtio6 Rc94h2vrrHlqWQl7lLDp+CvWCD5QBdm0IX7dzH0OqQQedBrw+Le5T47Dmsh6bSlAqJwM 4Thzkh4c3Mi/xg/iWIdha3fu+w/bs9keL0w+1MBdVBCdw+VsgQO+1s7h99cEdNvnj1Ot VSW2mMH2LuvVQB4OpiomR8KfUzOZ9T0XNqmQkIhvr9Of20nQWzasMvM4hq8h57xeF3yC mqZXW5bPwuFqrxP9PXOx5gVREPKOj8qd2s8cQFmlDA+IRbUutPpy8uTGg3XWPPnzR+X4 6lfQ== X-Forwarded-Encrypted: i=1; AHgh+RoVej6kgHAUQd69NAp7Hey/r6uWJ3JR/w5TAUduGJ9R8G+Bd16j1pbxOur22IdjMh5trnl9DNZ2q6YDZ08=@vger.kernel.org X-Gm-Message-State: AOJu0YyORq5fqCjxW7WHJ3GjGeczEGzQqm+CGEcoWUJUHcVWE9gAkBTC RCQ7wRci2fHWoGmEAKKTV32KeOL5D30cpVFvocJQ2D64NUHX8F2gZCJs X-Gm-Gg: AfdE7cmAQZcznT06Zbt/S17Si52Liq9IeWlC3jZrMbSi0fze85jOhaOz2SSaKZpUMT8 fMwJETGqvLN9pzsyxqfyAq/ZEVrGt2N48d5Zt30F2VQ5pOBGRL1J4QNbzWl5ZcNo2jfpCkX8WWb 3AOvMngMLmfCYJLd1R/wcFAGcfyHK5yH3gQsoRIJ1P4tl9P3LrAZFJfMDwpI67pCjNPBxwhv+hS Hxu/asXu4Mao4lVuhAayb3hxcDlokaZNxbbptlzfeC0sUVIWQIZsO0+BNh0T8WEF9z2/JK0/l+C +X/07CM0VTH65XknxaunvSr83YgTMVa8bDs17AD47MkHMwoQaodicrU102hX9AqKWtceHd20RXM YX9G3GvpHrsotJsSSI6ASH6TCw0HfqU5xnClHe+ev0FPryBk/XljEZFPFjZXPga2qVelBukcWUz MSd+LH1WQSeOnBdbCS09+lWaUv7UVUirT6HehhHO2BH+vP4Kqg6TrV7PkJ9ovmbIdyfsl45KdGO 4/T X-Received: by 2002:a05:690c:4507:b0:7e8:6a6a:dc11 with SMTP id 00721157ae682-81ecf86d451mr4640387b3.19.1784069575635; Tue, 14 Jul 2026 15:52:55 -0700 (PDT) Received: from localhost.localdomain ([2804:14d:4c64:82a2:a510:f4e7:1a8:cf71]) by smtp.gmail.com with ESMTPSA id 00721157ae682-81e6c249b87sm153446897b3.49.2026.07.14.15.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 15:52:55 -0700 (PDT) From: Rodrigo Gobbi 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 3/3] staging: media: atomisp: drop redundant out-of-memory messages Date: Tue, 14 Jul 2026 19:49:02 -0300 Message-ID: <20260714225235.47134-4-rodrigo.gobbi.7@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260714225235.47134-1-rodrigo.gobbi.7@gmail.com> References: <20260714225235.47134-1-rodrigo.gobbi.7@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On allocation failure the memory management core already emits a detailed warning, so the driver's own IA_CSS_ERROR("out of memory") lines add nothing but noise. Remove them; the error handling itself is left unchanged. Suggested-by: Andy Shevchenko Signed-off-by: Rodrigo Gobbi Reviewed-by: Andy Shevchenko --- drivers/staging/media/atomisp/pci/sh_css_param_dvs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c b/drivers= /staging/media/atomisp/pci/sh_css_param_dvs.c index ad2a9b84e232..c0102056d421 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c +++ b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c @@ -25,7 +25,6 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *fra= me_res, =20 dvs_config =3D kvmalloc_obj(struct ia_css_dvs_6axis_config); if (!dvs_config) { - IA_CSS_ERROR("out of memory"); err =3D -ENOMEM; } else { /*Initialize new struct with latest config settings*/ @@ -52,7 +51,6 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *fra= me_res, dvs_config->xcoords_y =3D kvmalloc(array3_size(width_y, height_y, sizeof= (uint32_t)), GFP_KERNEL); if (!dvs_config->xcoords_y) { - IA_CSS_ERROR("out of memory"); err =3D -ENOMEM; goto exit; } @@ -60,7 +58,6 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *fra= me_res, dvs_config->ycoords_y =3D kvmalloc(array3_size(width_y, height_y, sizeof= (uint32_t)), GFP_KERNEL); if (!dvs_config->ycoords_y) { - IA_CSS_ERROR("out of memory"); err =3D -ENOMEM; goto exit; } @@ -72,7 +69,6 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *fra= me_res, sizeof(uint32_t)), GFP_KERNEL); if (!dvs_config->xcoords_uv) { - IA_CSS_ERROR("out of memory"); err =3D -ENOMEM; goto exit; } @@ -81,7 +77,6 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *fra= me_res, sizeof(uint32_t)), GFP_KERNEL); if (!dvs_config->ycoords_uv) { - IA_CSS_ERROR("out of memory"); err =3D -ENOMEM; } exit: --=20 2.48.1