Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: update type of buf size to u32 for eeprom functions

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>

authored by

Tao Zhou and committed by
Alex Deucher
2aadb520 28e782b2

+5 -5
+3 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
··· 179 179 * Returns the number of bytes read/written; -errno on error. 180 180 */ 181 181 static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr, 182 - u8 *eeprom_buf, u16 buf_size, bool read) 182 + u8 *eeprom_buf, u32 buf_size, bool read) 183 183 { 184 184 const struct i2c_adapter_quirks *quirks = i2c_adap->quirks; 185 185 u16 limit; ··· 225 225 226 226 int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap, 227 227 u32 eeprom_addr, u8 *eeprom_buf, 228 - u16 bytes) 228 + u32 bytes) 229 229 { 230 230 return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes, 231 231 true); ··· 233 233 234 234 int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap, 235 235 u32 eeprom_addr, u8 *eeprom_buf, 236 - u16 bytes) 236 + u32 bytes) 237 237 { 238 238 return amdgpu_eeprom_xfer(i2c_adap, eeprom_addr, eeprom_buf, bytes, 239 239 false);
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.h
··· 28 28 29 29 int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap, 30 30 u32 eeprom_addr, u8 *eeprom_buf, 31 - u16 bytes); 31 + u32 bytes); 32 32 33 33 int amdgpu_eeprom_write(struct i2c_adapter *i2c_adap, 34 34 u32 eeprom_addr, u8 *eeprom_buf, 35 - u16 bytes); 35 + u32 bytes); 36 36 37 37 #endif