From: Kunwu Chan <chentao@xxxxxxxxxx>
Date: Tue, 5 Dec 2023 17:58:44 +0800
The size of "i40e_dbg_command_buf" is 256, the size of "name"
depends on "IFNAMSIZ", plus a null character and format size,
the total size is more than 256.
Improve readability and maintainability by replacing a hardcoded string
allocation and formatting by the use of the kasprintf() helper.
Fixes: 02e9c290814c ("i40e: debugfs interface")
Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>
Suggested-by: Simon Horman <horms@xxxxxxxxxx>
Suggested-by: Alexander Lobakin <aleksander.lobakin@xxxxxxxxx>
Your Signed-off-by must be the last tag in the block.
Perhaps the maintainer could fix it when taking, so that you wouldn't
need to send a new version only due to that.
---
v2
- Update the size calculation with IFNAMSIZ and sizeof(i40e_dbg_command_buf)
v3
- Use kasprintf to improve readability and maintainability
v4
- Fix memory leak in error path