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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <083cd51b-06d8-4618-8517-a2bc2fa31554@web.de>
Date: Fri, 14 Jun 2024 22:20:38 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Hao Ge <gehao@...inos.cn>, linux-sound@...r.kernel.org,
 Jaroslav Kysela <perex@...ex.cz>, Liam Girdwood <lgirdwood@...il.com>,
 Mark Brown <broonie@...nel.org>, Shenghao Ding <shenghao-ding@...com>,
 Takashi Iwai <tiwai@...e.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
 Colin Ian King <colin.i.king@...il.com>
Subject: Re: [PATCH] ASoc: PCM6240: Fix a null pointer dereference in
 pcmdevice_i2c_probe

> When devm_kzalloc return NULL,we return -ENOMEM directly to

This information fits to a coding style advice.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.10-rc3#n532


> avoid a null pointer that call pcmdevice_remove which will
> perform some operations on the members of the pcm_dev;

You pointed in an improvable way out that the label “out” was questionable
after the assignment of a well-known error code at the beginning.
https://elixir.bootlin.com/linux/v6.10-rc3/source/sound/soc/codecs/pcm6240.c#L2077


Can a wording approach (like the following) be a better change description?

   The value “-ENOMEM” was assigned to the local variable “ret”
   in one if branch after a devm_kzalloc() call failed at the beginning.
   This error code will trigger then a pcmdevice_remove() call
   with a passed null pointer so that an undesirable dereference
   will be performed.
   Thus return the appropriate error code directly.


Can a summary phrase like “Return directly after a failed devm_kzalloc()
in pcmdevice_i2c_probe()” be also helpful?

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ