In the previous implementation, when the user did not enter any value in "/sys/module/firmware_class/parameters/path", it would incorrectly search for DDP packages under "/". This commit fixes this issue.
Fixes: 9207f93640a7 ("net/ice: support custom search path for DDP package") Signed-off-by: Zhichao Zeng <zhichaox.z...@intel.com> --- drivers/net/ice/ice_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index d5e94a6685..0705f8e961 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1922,8 +1922,11 @@ static int ice_read_customized_path(char *pkg_file, uint16_t buff_len) return -EIO; } - if (pkg_file[n - 1] == '\n') + if (pkg_file[n - 1] == '\n') { n--; + if (n == 0) + return -EINVAL; + } pkg_file[n] = '\0'; -- 2.34.1