<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><font face="monospace">Hi Steve<br>
The patch looks ok to me.</font><br>
</p>
<div class="moz-cite-prefix">On 1/20/2022 8:29 AM, Steve Yang wrote:<br>
</div>
<blockquote type="cite" cite="mid:20220120025931.574106-3-stevex.yang@intel.com">
<pre class="moz-quote-pre" wrap="">When the size of EEPROM exceeds the default thread stack size(8MB),
e.g.: 10Mb size, it will be cashed with stack overflow.
</pre>
</blockquote>
<font face="monospace">Just spelling: 10Mb/10MB, cashed/crashed<br>
Can even rephrase, like: it will crash due to stack overflow</font><br>
<blockquote type="cite" cite="mid:20220120025931.574106-3-stevex.yang@intel.com">
<pre class="moz-quote-pre" wrap="">
Allocate the data of EPPROM information on the heap.
Fixes: 6b67721dee2a ("app/testpmd: add EEPROM command")
Signed-off-by: Steve Yang <a class="moz-txt-link-rfc2396E" href="mailto:stevex.yang@intel.com"><stevex.yang@intel.com></a></pre>
</blockquote>
<br>
<pre><span class="acked-by" style="box-sizing: border-box; color: rgb(45, 69, 102);">Acked-by: Aman Singh <a class="moz-txt-link-rfc2396E" href="mailto:aman.deep.singh@intel.com"><aman.deep.singh@intel.com></a></span></pre>
<blockquote type="cite" cite="mid:20220120025931.574106-3-stevex.yang@intel.com">
<pre class="moz-quote-pre" wrap="">
---
app/test-pmd/config.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1722d6c8f8..e812f57151 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -912,10 +912,15 @@ port_eeprom_display(portid_t port_id)
return;
}
- char buf[len_eeprom];
einfo.offset = 0;
einfo.length = len_eeprom;
- einfo.data = buf;
+ einfo.data = calloc(1, len_eeprom);
+ if (!einfo.data) {
+ fprintf(stderr,
+ "Allocation of port %u eeprom data failed\n",
+ port_id);
+ return;
+ }
ret = rte_eth_dev_get_eeprom(port_id, &einfo);
if (ret != 0) {
@@ -933,10 +938,12 @@ port_eeprom_display(portid_t port_id)
fprintf(stderr, "Unable to get EEPROM: %d\n", ret);
break;
}
+ free(einfo.data);
return;
}
rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
printf("Finish -- Port: %d EEPROM length: %d bytes\n<a class="moz-txt-link-rfc2396E" href="mailto:,port_id,len_eeprom);+free(einfo.data);}void@@-972,10+979,15@@port_module_eeprom_display(portid_tport_id)return;}-charbuf[minfo.eeprom_len];einfo.offset=0;einfo.length=minfo.eeprom_len;-einfo.data=buf;+einfo.data=calloc(1,minfo.eeprom_len);+if(!einfo.data){+fprintf(stderr,+">", port_id, len_eeprom);
+ free(einfo.data);
}
void
@@ -972,10 +979,15 @@ port_module_eeprom_display(portid_t port_id)
return;
}
- char buf[minfo.eeprom_len];
einfo.offset = 0;
einfo.length = minfo.eeprom_len;
- einfo.data = buf;
+ einfo.data = calloc(1, minfo.eeprom_len);
+ if (!einfo.data) {
+ fprintf(stderr,
+ "</a>Allocation of port %u eeprom data failed\n",
+ port_id);
+ return;
+ }
ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);
if (ret != 0) {
@@ -994,11 +1006,13 @@ port_module_eeprom_display(portid_t port_id)
ret);
break;
}
+ free(einfo.data);
return;
}
rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
printf("Finish -- Port: %d MODULE EEPROM length: %d bytes\n", port_id, einfo.length);
+ free(einfo.data);
}
int
</pre>
</blockquote>
</body>
</html>