drm/amdgpu: update type of buf size to u32 for eeprom functions
authorTao Zhou <tao.zhou1@amd.com>
Fri, 17 May 2024 10:04:26 +0000 (18:04 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 20 May 2024 20:20:26 +0000 (16:20 -0400)
Avoid overflow issue.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h

index e71768661ca8d25808ac3d5a2e6bf59bc8b8d98b..09a34c7258e226d3290cdf4f61230cae1630a7e1 100644 (file)
@@ -179,7 +179,7 @@ static int __amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
  * Returns the number of bytes read/written; -errno on error.
  */
 static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
-                             u8 *eeprom_buf, u16 buf_size, bool read)
+                             u8 *eeprom_buf, u32 buf_size, bool read)
 {
        const struct i2c_adapter_quirks *quirks = i2c_adap->quirks;
        u16 limit;
@@ -225,7 +225,7 @@ static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
 
 int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,
                       u32 eeprom_addr, u8 *eeprom_buf,
-                      u16 bytes)
+                      u32 bytes)
 {
        return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,
                                  true);
@@ -233,7 +233,7 @@ int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,
 
 int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap,
                        u32 eeprom_addr, u8 *eeprom_buf,
-                       u16 bytes)
+                       u32 bytes)
 {
        return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes,
                                  false);
index 6935adb2be1f1c719a01fb8bf23b899ee24e71a5..8083b8253ef4333619f4f409c5215e7be7358b07 100644 (file)
 
 int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,
                       u32 eeprom_addr, u8 *eeprom_buf,
-                      u16 bytes);
+                      u32 bytes);
 
 int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap,
                        u32 eeprom_addr, u8 *eeprom_buf,
-                       u16 bytes);
+                       u32 bytes);
 
 #endif