lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250317-sound-avs-kcalloc-v2-0-20e2a132b18f@ethancedwards.com>
Date: Mon, 17 Mar 2025 08:21:55 -0400
From: Ethan Carter Edwards <ethan@...ancedwards.com>
To: Cezary Rojewski <cezary.rojewski@...el.com>, 
 Liam Girdwood <liam.r.girdwood@...ux.intel.com>, 
 Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>, 
 Bard Liao <yung-chuan.liao@...ux.intel.com>, 
 Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>, 
 Kai Vehmanen <kai.vehmanen@...ux.intel.com>, 
 Pierre-Louis Bossart <pierre-louis.bossart@...ux.dev>, 
 Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>, 
 Takashi Iwai <tiwai@...e.com>
Cc: gustavoars@...nel.org, linux-sound@...r.kernel.org, 
 linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org, 
 Ethan Carter Edwards <ethan@...ancedwards.com>
Subject: [PATCH v2 0/4] ASoC: Intel: avs: Replace devm_kzalloc() with
 devm_kcalloc()

Open coded arithmetic in allocator arguments is discouraged. Helper
functions like kcalloc or, in this case, devm_kcalloc are preferred. Not
only for readability purposes but safety purposes.

The changes move `devm_kzalloc(dev, sizeof(var) * n, GFP_KERNEL)` to
the helper function `devm_kcalloc(dev, n, sizeof(var), GFP_KERNEL)`.

Here is a series of four patches within the Intel/avs drivers that make
these changes. They are all compile tested only but should have no
effect on runtime behaviour.
    
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/162

Signed-off-by: Ethan Carter Edwards <ethan@...ancedwards.com>
---
Changes in v2:
- change subjects to include avs
- change commit message to Replace devm_kzalloc() with devm_kcalloc
- Change from Link: to [1]:
- Link to v1: https://lore.kernel.org/r/20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com

---
Ethan Carter Edwards (4):
      ASoC: Intel: avs: Replace devm_kzalloc() with devm_kcalloc()
      ASoC: Intel: avs: ssm4567: Replace devm_kzalloc() with devm_kcalloc()
      ASoC: Intel: avs: max98373: Replace devm_kzalloc() with devm_kcalloc()
      ASoC: Intel: avs: max98927: Replace devm_kzalloc() with devm_kcalloc()

 sound/soc/intel/avs/boards/max98373.c | 2 +-
 sound/soc/intel/avs/boards/max98927.c | 2 +-
 sound/soc/intel/avs/boards/ssm4567.c  | 2 +-
 sound/soc/intel/avs/pcm.c             | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: da920b7df701770e006928053672147075587fb2
change-id: 20250314-sound-avs-kcalloc-91cedbc47074

Best regards,
-- 
Ethan Carter Edwards <ethan@...ancedwards.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ