mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
f5f43aae6f
strncpy() is deprecated and needs to be replaced. The volume label information strings are not nul-terminated and strncpy() can simply be replaced with memcpy(). To enhance the readability of find_label() alongside this change, the following improvements are made: - Introduce the array dasd_vollabels[] containing all information necessary for the label detection. - Provide a helper function to obtain an index value corresponding to a volume label type. This allows the use of a switch statement to reduce indentation levels. - The 'temp' variable is used to check against valid volume label types. In the good case, this variable already contains the volume label type making it unnecessary to copy the information again from e.g. label->vol.vollbl. Remove the 'temp' variable and the second copy as all information are already provided. - Remove the 'found' variable and replace it with early returns Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://lore.kernel.org/r/20230915131001.697070-3-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk> |
||
---|---|---|
.. | ||
acorn.c | ||
aix.c | ||
amiga.c | ||
atari.c | ||
atari.h | ||
check.h | ||
cmdline.c | ||
core.c | ||
efi.c | ||
efi.h | ||
ibm.c | ||
karma.c | ||
Kconfig | ||
ldm.c | ||
ldm.h | ||
mac.c | ||
mac.h | ||
Makefile | ||
msdos.c | ||
osf.c | ||
sgi.c | ||
sun.c | ||
sysv68.c | ||
ultrix.c |