Re: [PATCH v2] b43legacy: Add checking for null for ssb_get_devtypedata(dev)

Michael Büsch <[email protected]>
Newsgroups org.infradead.lists.b43-dev,org.kernel.vger.linux-kernel,org.kernel.vger.linux-wireless,org.kernel.vger.netdev
Message-ID <20230418181204.473e7898@barney>
On Tue, 18 Apr 2023 07:29:18 -0700
Nikita Zhandarovich <[email protected]> wrote:

> Since second call of ssb_get_devtypedata() may fail as well as the
> first one, the NULL return value in 'wl' will be later dereferenced in
> calls to b43legacy_one_core_attach() and schedule_work().

No, the second call can't fail, because b43legacy_wireless_init() will
always initialize it before returning 0.

> a/drivers/net/wireless/broadcom/b43legacy/main.c +++
> b/drivers/net/wireless/broadcom/b43legacy/main.c @@ -3857,7 +3857,11
> @@ static int b43legacy_probe(struct ssb_device *dev, if (err)
>  			goto out;
>  		wl = ssb_get_devtypedata(dev);
> -		B43legacy_WARN_ON(!wl);
> +		if (!wl) {
> +			B43legacy_WARN_ON(!wl);
> +			err = -ENODEV;
> +			goto out;

And the 'goto out' would be the wrong error recovery path, too.

> +		}
>  	}
>  	err = b43legacy_one_core_attach(dev, wl);
>  	if (err)


Nack.
Please drop this patch. The code is correct as-is.

-- 
Michael Büsch
https://bues.ch/

_______________________________________________
b43-dev mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/b43-dev
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEihRzkKVZOnT2ipsS9TK+HZCNiw4FAmQ+wVQACgkQ9TK+HZCN
iw7NzQ/9Ggyc5BtRToTBofdZbjnH/R/WeFz+RxXwxYLinJkQ/Cq6ilPkvqwf7w+y
6HltbMZ3xDd2+wqG9PGKwTqNy0on4Ja92nBZ+rh4zyIfOb8ng3/i6dkNkzd67QAc
vPzBblo2UMf8IUyJMhUGixGNNAZ+QK2iosPETZyG6Kk/UOVbkc1Ht2/Gxo67S2mK
rxezpiS253ECGpfkz7dFvooCwga2UmejgY3C547dcvmNTvvLh9xYFe99f1PtQc7m
IphZn5VLXOx1ptjVSzm2DE7pQjNdU0VaeGOjolmGtyBoWC2DqgqKEuDDgxkGhs2y
ZBLp8adRdGaZyU0Vp88xZJJtMXLrl2hvRqM29rSCRIve5FUjRkDovBbRsaVoogsy
1SHYuKwpY97j+PW8eZgsJ4L13cDsSZUYGcRG0l9rrq3B8K02VFEnAlFN/D0WXdRY
HKILvc3xjo+8MmM01gXeTfLan7i3PiTvi03cxM88Inh0zMQ1zV1w+eaXYR8VDpmF
grhBA94GsbeulgkNL19Lj7HQOmJ74QRWF+r2HhgwOlEOy7bqYKkM4Ht1Op4Sx85j
FpgQzjuGo9cVAZTVdr5JBPfI7Yd+1WJZm92HlR9iII9JFhrrDA19u11zTuBy6j/n
g6Y7bIyJiTmBD8trj8nRno2QVB75qevcQFBu/yOVXCwd68hzxlg=
=OX2A
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.