<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:10pt;">
<div style="padding-right:5pt;padding-left:5pt;"><font color="blue">[AMD Official Use Only - AMD Internal Distribution Only]<br>
</font></div>
<div style="margin-top:5pt;"><font face="Times New Roman" size="3"><span style="font-size:12pt;"><br>
</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Hmm… but in __amdgpu_eeprom_xfer, the u32 will still be cut to u16.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">__amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr, u8 *eeprom_buf, <b>u16 buf_size</b>, bool read)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Regards,<br>
Hawking</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Tao Zhou<br>
Sent: Monday, May 20, 2024 10:46<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Zhou1, Tao <Tao.Zhou1@amd.com><br>
Subject: [PATCH] drm/amdgpu: update type of buf size to u32 for eeprom functions</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Avoid overflow issue.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Signed-off-by: Tao Zhou <<a href="mailto:tao.zhou1@amd.com">tao.zhou1@amd.com</a>></span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">---</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h | 4 ++--</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> 2 files changed, 5 insertions(+), 5 deletions(-)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index e71768661ca8..09a34c7258e2 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -179,7 +179,7 @@ static int __amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> * Returns the number of bytes read/written; -errno on error.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- u8 *eeprom_buf, u16 buf_size, bool read)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u8 *eeprom_buf, u32 buf_size, bool read)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> const struct i2c_adapter_quirks *quirks = i2c_adap->quirks;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> u16 limit;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -225,7 +225,7 @@ static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> u32 eeprom_addr, u8 *eeprom_buf,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- u16 bytes)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 bytes)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> true);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -233,7 +233,7 @@ int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> u32 eeprom_addr, u8 *eeprom_buf,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- u16 bytes)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 bytes)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> false);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 6935adb2be1f..8083b8253ef4 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -28,10 +28,10 @@</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> u32 eeprom_addr, u8 *eeprom_buf,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- u16 bytes);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 bytes);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> u32 eeprom_addr, u8 *eeprom_buf,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- u16 bytes);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 bytes);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #endif</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">2.34.1</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
</span></font>
</body>
</html>