From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f177.google.com (mail-dy1-f177.google.com [74.125.82.177]) (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 C947736EAAC for ; Mon, 22 Jun 2026 22:44:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782168259; cv=none; b=ZMVBl3nxdAZE7AoaBu3QAEnO1W8CQNUo8LCGoWtj7kNrddhUufRUCEfmnxPkuYLYBosrwExJ9N+Wu+jeV1JO5bQTMLI1TExYMvWrSs8aCgONJ02SSCVItUWivvjvodyZ/OpXEMnNG13OY6sjZ59caiXQL6h/p6hdVqVgFl2Wdss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782168259; c=relaxed/simple; bh=W5lWlahgJwGGtGLW0ih66TpOa9zremeMUWH0zXFLfPA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ioMi/17Ill+T+vohy+sFJYQo8SvHd8db6inI9CNmdAWqsewrucufvQXDnLh6JgLaCJEKF4ojSRaTX7yRaE65wal7G4OGUrEMG5P+JCNGaUg7paMq5umWuAZcyjZyVLNT39gOO7JkuGDVpSV3aqpTT/Xx6TclnNpkQKvuhpV1K8g= 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=YijQmomp; arc=none smtp.client-ip=74.125.82.177 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="YijQmomp" Received: by mail-dy1-f177.google.com with SMTP id 5a478bee46e88-30bf8b2bd20so8946726eec.0 for ; Mon, 22 Jun 2026 15:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782168257; x=1782773057; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9Js5zTXLWCpFXjeLRJmY47TLMJHvqvUtd9vW4J/ry+I=; b=YijQmompk2amt0nsa+sySLtZDDydGl7GTOWsJcAarzgwZq+ZQSsLdAhm9GSIRdiT34 yFILi1OdjtRN14PdOufd0C7OpnnWQ18ByzyWkU4pNiv3/qKepkk69tWAptHlQ7PGEFV+ BSKm8v81upwNAes9SYw/OSx0FkKD+oxouE/yYOMwbPy46Sf9N+HFeTkyG3cfDjF3MefW cuMyZ/zUIbxbO8lu1KiNKwyt7cySI/TEn0jiVB9wiDvF8mEV6jO1MhSgb0OUigkd6PU0 LWgp6jozd/yilKHQRqJyHEIx4zrv6+K5H6cpxPtU4+5kcWthBHEPe4UXnCpHUTnS5UHg 0QTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782168257; x=1782773057; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9Js5zTXLWCpFXjeLRJmY47TLMJHvqvUtd9vW4J/ry+I=; b=ZB/T51IGj8wLEfWrlTUiMqHTAe26y500GuW/cNvJaLeYlCDJAQXWo2x/Q35BL5n3XF fQVsfkC2pkdKK3tE8zzg06RWvSfhgocBR3zMdWDB5gBE5c4VvxujnGWDzq2DluXyvim7 oGxd31SOAfOXMrDpIcnVEPksoEl8Ia4aZzvaUW0p+5AhIzdF9+/QiWUSN8sRADDRa6OG Nw5HCdq8y21IdseXCfy6j4XLoEMZpeU8FW4/e/gjJIvU5KjxchsFLbwCd123JkGH8XMG SZaT2GRIQiy1BvzReRvqDf1w+JFmClyrWxhPgd6BgUi5mRQ5h2rmm79lTG+PROqX+vhC vPdg== X-Forwarded-Encrypted: i=1; AHgh+RqqrThZ4O7ZkMLzO4JfRLym33lpRpQyW/5Tkr7VRPNbMvgxU6z9th9faj2g8kcOF2NOqwPaOMbE+UpYWYA=@vger.kernel.org X-Gm-Message-State: AOJu0YzAo0ENtw0AkAK2O/coXHvCbHYvK5iW/sNjgNoUAYw0X4A44U+M litQm6+atalTlhk6woq06LqJ6hY9ConQD+gl+48cGV6+k+NpeGPQiSDK X-Gm-Gg: AfdE7cktZk7GYWWOOD7oCjlGTghBIDgXJlX/E4cmo4E4yWNO6fFoiGZHkP20i9lLjSi 1XHoytTE32BmovoeUpYgOU5yzguu91OE+1CcPrDhXz1pujQe9QAg19mUKTrzf8hbwB3IawOw6Wr 1XYzoxh75+Y/Gyaqi8rcGAgG0zrL2t7m0z4kDPhPwpczGYft1zrJXa6RMNBFBVBrTqbd3EHvuzw 7L45wzuxmaJVv8xQvV6aFzNfPhpzBSWyU5hzvBazK5g/uHOnKO42NbUtV7OMzmljyERYqTP4meK 9e1hka7xelfddBLStVRi10uojGyZKIW7EQ0m3zIYMma/JaAIGcVZ3Oxxm3q9Xc3nogCijAcKnM7 N5p5MaUlU7ikF16Zk2Mm9g+9TigXoH5suGrufd+g0tEF7tOgxLoymvtGTcd0hC+BXyOWtMdqWu4 tHebHQLZvhZ0vMNmGa8CIw5F2tmDHN1/uaFBbKymaoZNMGyXIKtd72JroVSKsTAr2btXU= X-Received: by 2002:a05:7300:ac8a:b0:304:6d18:3646 with SMTP id 5a478bee46e88-30c1d5955c6mr8674408eec.0.1782168256832; Mon, 22 Jun 2026 15:44:16 -0700 (PDT) Received: from localhost.localdomain ([2804:14d:4c64:82a2:691c:629b:eda4:7c2e]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30c1ba1c376sm13087954eec.3.2026.06.22.15.44.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2026 15:44:16 -0700 (PDT) From: Rodrigo Gobbi To: andy@kernel.org, hansg@kernel.org, mchehab@kernel.org, sakari.ailus@linux.intel.com, gregkh@linuxfoundation.org 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 v2 0/3] staging: media: atomisp: use kvmalloc_objs() and drop redundant OOM messages Date: Mon, 22 Jun 2026 19:42:41 -0300 Message-ID: <20260622224402.34001-1-rodrigo.gobbi.7@gmail.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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] https://github.com/torvalds/linux/commit/d178c7ca8fefc28115d35b94c3b1f4d653e34182 [3] https://lore.kernel.org/all/20260609215110.118860-1-rodrigo.gobbi.7@gmail.com/ --- Hi, all, Regarding a comment from Andy at [3]: > From: Andy Shevchenko > On Tue, Jun 09, 2026 at 06:46:31PM -0300, Rodrigo Gobbi wrote: > Replace kvmalloc() with multiply with kvmalloc_objs(), which handles > the size multiplication internally with overflow checking, silenting > checkpatch warn. > > Signed-off-by: Rodrigo Gobbi > --- > Hi, all, > There is a ongoing effort like this for other files from atomisp > at [1], yet, it is not covering the same file. > Tks and regards. > > [1] https://lore.kernel.org/all/20260413112904.98864-1-feng@innora.ai/ > Yeah, the problem is that the activity seems stale. Can you pickup all > the patches from the mailing list that have not been yet applied (regarding > k*alloc() uses) and combine them into series or so and update regarding to > Sakari's comments? The only patches that I found from stale threads were added in this series, hope that is fine now. Tks and regards. Changelog: v2: convert to a series with additional stale patches; v1: https://lore.kernel.org/all/20260609215110.118860-1-rodrigo.gobbi.7@gmail.com/ --- Rodrigo Gobbi (3): staging: media: atomisp: use kvmalloc_objs() in make_histogram() staging: media: atomisp: use kvmalloc_objs() for overflow-safe allocation 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