Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pds_core: limit loop over fw name list

Add an array size limit to the for-loop to be sure we don't try
to reference a fw_version string off the end of the fw info names
array. We know that our firmware only has a limited number
of firmware slot names, but we shouldn't leave this unchecked.

Fixes: 45d76f492938 ("pds_core: set up device and adminq")
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250103195147.7408-1-shannon.nelson@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Shannon Nelson and committed by
Jakub Kicinski
8c817eb2 8ce4f287

+1 -1
+1 -1
drivers/net/ethernet/amd/pds_core/devlink.c
··· 118 118 if (err && err != -EIO) 119 119 return err; 120 120 121 - listlen = fw_list.num_fw_slots; 121 + listlen = min(fw_list.num_fw_slots, ARRAY_SIZE(fw_list.fw_names)); 122 122 for (i = 0; i < listlen; i++) { 123 123 if (i < ARRAY_SIZE(fw_slotnames)) 124 124 strscpy(buf, fw_slotnames[i], sizeof(buf));