Files
mirror_zfs/module/zfs
Richard Yao cfb49616cd Cleanup: spa vdev processing should check NULL pointers
The PVS Studio 2016 FreeBSD kernel report stated:

\contrib\opensolaris\uts\common\fs\zfs\spa.c (1341): error V595: The 'spa->spa_spares.sav_vdevs' pointer was utilized before it was verified against nullptr. Check lines: 1341, 1342.
\sys\cddl\contrib\opensolaris\uts\common\fs\zfs\spa.c (1355): error V595: The 'spa->spa_l2cache.sav_vdevs' pointer was utilized before it was verified against nullptr. Check lines: 1355, 1357.
\sys\cddl\contrib\opensolaris\uts\common\fs\zfs\spa.c (1398): error V595: The 'spa->spa_spares.sav_vdevs' pointer was utilized before it was verified against nullptr. Check lines: 1398, 1408.
\sys\cddl\contrib\opensolaris\uts\common\fs\zfs\spa.c (1583): error V595: The 'oldvdevs' pointer was utilized before it was verified against nullptr. Check lines: 1583, 1595.

In practice, all of these uses were safe because a NULL pointer
implied a 0 vdev count, which kept us from iterating over vdevs.
However, rearranging the code to check the pointer first is not a
terrible micro-optimization and makes it more readable, so let us
do that.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14456
2023-02-06 11:09:28 -08:00
..
2022-03-15 15:13:42 -07:00
2022-03-15 15:13:42 -07:00
2023-01-25 11:30:24 -08:00
2023-01-10 13:39:22 -08:00
2022-10-20 11:57:15 -07:00
2022-10-29 13:05:11 -07:00
2023-01-04 17:29:54 -07:00
2023-01-12 16:00:23 -08:00
2023-01-04 17:29:54 -07:00
2023-01-25 11:30:24 -08:00
2023-01-20 11:01:41 -08:00
2022-03-15 15:13:42 -07:00
2022-03-15 15:13:42 -07:00
2022-01-07 10:36:49 -08:00
2022-01-12 16:14:36 -08:00
2019-06-19 09:48:12 -07:00
2022-10-12 11:25:18 -07:00
2022-09-30 15:34:39 -07:00
2022-03-15 15:13:42 -07:00
2023-01-25 11:28:54 -08:00
2022-10-27 09:54:54 -07:00
2022-10-20 11:57:15 -07:00
2022-09-02 13:31:19 -07:00
2023-01-12 16:00:30 -08:00
2022-10-28 09:49:20 -07:00
2023-01-24 09:20:32 -08:00
2022-11-29 09:26:03 -08:00