mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 02:40:34 +00:00
wacom-raw: Fix an impossible to hit overflow (#3082)
Spotted by Coverity.
This commit is contained in:
parent
541a71b140
commit
18dcb6f511
@ -175,10 +175,10 @@ fu_wacom_aes_device_write_block (FuWacomAesDevice *self,
|
||||
guint32 idx,
|
||||
guint32 address,
|
||||
const guint8 *data,
|
||||
guint16 datasz,
|
||||
gsize datasz,
|
||||
GError **error)
|
||||
{
|
||||
guint blocksz = fu_wacom_device_get_block_sz (FU_WACOM_DEVICE (self));
|
||||
gsize blocksz = fu_wacom_device_get_block_sz (FU_WACOM_DEVICE (self));
|
||||
FuWacomRawRequest req = {
|
||||
.cmd = FU_WACOM_RAW_BL_CMD_WRITE_FLASH,
|
||||
.echo = (guint8) idx + 1,
|
||||
@ -194,7 +194,7 @@ fu_wacom_aes_device_write_block (FuWacomAesDevice *self,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"block size 0x%x != 0x%x untested",
|
||||
datasz, (guint) blocksz);
|
||||
(guint) datasz, (guint) blocksz);
|
||||
return FALSE;
|
||||
}
|
||||
memcpy (&req.data, data, datasz);
|
||||
|
@ -39,7 +39,7 @@ fu_wacom_device_to_string (FuDevice *device, guint idt, GString *str)
|
||||
fu_common_string_append_kx (str, idt, "FlashSize", priv->flash_size);
|
||||
}
|
||||
|
||||
guint
|
||||
gsize
|
||||
fu_wacom_device_get_block_sz (FuWacomDevice *self)
|
||||
{
|
||||
FuWacomDevicePrivate *priv = GET_PRIVATE (self);
|
||||
|
@ -44,5 +44,5 @@ gboolean fu_wacom_device_erase_all (FuWacomDevice *self,
|
||||
GError **error);
|
||||
gboolean fu_wacom_device_check_mpu (FuWacomDevice *self,
|
||||
GError **error);
|
||||
guint fu_wacom_device_get_block_sz (FuWacomDevice *self);
|
||||
gsize fu_wacom_device_get_block_sz (FuWacomDevice *self);
|
||||
guint fu_wacom_device_get_base_addr (FuWacomDevice *self);
|
||||
|
@ -136,10 +136,10 @@ fu_wacom_emr_device_write_block (FuWacomEmrDevice *self,
|
||||
guint32 idx,
|
||||
guint32 address,
|
||||
const guint8 *data,
|
||||
guint16 datasz,
|
||||
gsize datasz,
|
||||
GError **error)
|
||||
{
|
||||
guint blocksz = fu_wacom_device_get_block_sz (FU_WACOM_DEVICE (self));
|
||||
gsize blocksz = fu_wacom_device_get_block_sz (FU_WACOM_DEVICE (self));
|
||||
FuWacomRawRequest req = {
|
||||
.cmd = FU_WACOM_RAW_BL_CMD_WRITE_FLASH,
|
||||
.echo = (guint8) idx + 1,
|
||||
@ -155,7 +155,7 @@ fu_wacom_emr_device_write_block (FuWacomEmrDevice *self,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"data size 0x%x too large for packet",
|
||||
datasz);
|
||||
(guint) datasz);
|
||||
return FALSE;
|
||||
}
|
||||
if (datasz != blocksz) {
|
||||
@ -163,7 +163,7 @@ fu_wacom_emr_device_write_block (FuWacomEmrDevice *self,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"block size 0x%x != 0x%x untested",
|
||||
datasz, (guint) blocksz);
|
||||
(guint) datasz, (guint) blocksz);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user