i40e: Limit expression passed to kzalloc() to 1280 bytes
Subsystems (2)
PATCH v2 1/1 i40e: Limit expression passed to kzalloc() to 1280 bytes
Add buff_size limit of 1280 bytes as big enough for user input value.
--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +1 -1
@@ -1356,7 +1356,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, goto command_write_done; }/* Just stub a buffer big enough in case user messed up */ -if (buffer_len ==0 ) +if (buffer_len ==0 || buffer_len >1280 ) buffer_len =1280 ; buff =kzalloc (buffer_len,GFP_KERNEL );
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerOn 3/30/2023 3:37 AM, Aleksandr Loktionov wrote:
Why the multiple sends?
2023-03-30 10:37 UTC - [PATCH net v2] i40e: Limit expression passed to kzalloc() to 1280 bytes [1] 2023-03-30 11:17 UTC - [PATCH net v2] i40e: Limit expression passed to kzalloc() to 1280 bytes [2] 2023-03-30 11:20 UTC - [PATCH net v2] i40e: Limit expression passed to kzalloc() to 1280 bytes [3]
Quoted 5 lines
Add
buff_sizelimit of 1280 bytes as big enough for user input value.Fixes f1143c4b0f60 ("i40e: Expose AQ debugfs hooks")Signed-off-by Aleksandr Loktionov <[email protected]>---
Please include a changelog for new revisions.
drivers/net/ethernet/intel/i40e/i40e_debugfs.c static ssize_t i40e_dbg_command_write(struct file *filp, · line 1359
Quoted 13 lines
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/i40e/i40e_debugfs.c +1
-1@@ -1356,7 +1356,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, goto command_write_done; }/* Just stub a buffer big enough in case user messed up */ -if (buffer_len ==0 ) +if (buffer_len ==0 || buffer_len >1280 )
Based on Paul's question, it may be nice to add a comment here to explain the 1280 size; "big enough for user input value" doesn't really explain how we ended up at 1280.
Thanks,
Tony
drivers/net/ethernet/intel/i40e/i40e_debugfs.c static ssize_t i40e_dbg_command_write(struct file *filp, · line 1361
Quoted 2 lines
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +0
-0buffer_len = 1280; > buff =kzalloc (buffer_len,GFP_KERNEL );
[1] https://lore.kernel.org/intel-wired-lan/[email protected]/
[2] https://lore.kernel.org/intel-wired-lan/[email protected]/
[3] https://lore.kernel.org/intel-wired-lan/[email protected]/
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan