mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-28 07:50:12 +00:00
trivial: Fix some 'Comparison of narrow type with wide type in loop condition'
This commit is contained in:
parent
8994baac4e
commit
633571fa99
@ -385,7 +385,7 @@ fu_srec_firmware_parse(FuFirmware *firmware,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* could be anything, lets assume text */
|
/* could be anything, lets assume text */
|
||||||
for (guint8 i = 0; i < rcd->buf->len; i++) {
|
for (guint i = 0; i < rcd->buf->len; i++) {
|
||||||
gchar tmp = rcd->buf->data[i];
|
gchar tmp = rcd->buf->data[i];
|
||||||
if (!g_ascii_isgraph(tmp))
|
if (!g_ascii_isgraph(tmp))
|
||||||
break;
|
break;
|
||||||
|
@ -350,7 +350,7 @@ fu_dfu_csr_device_download(FuDevice *device,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FuDfuCsrDevice *self = FU_DFU_CSR_DEVICE(device);
|
FuDfuCsrDevice *self = FU_DFU_CSR_DEVICE(device);
|
||||||
guint16 idx;
|
guint idx;
|
||||||
g_autoptr(GBytes) blob_empty = NULL;
|
g_autoptr(GBytes) blob_empty = NULL;
|
||||||
g_autoptr(GBytes) blob = NULL;
|
g_autoptr(GBytes) blob = NULL;
|
||||||
g_autoptr(GPtrArray) chunks = NULL;
|
g_autoptr(GPtrArray) chunks = NULL;
|
||||||
@ -369,6 +369,14 @@ fu_dfu_csr_device_download(FuDevice *device,
|
|||||||
0x0,
|
0x0,
|
||||||
FU_DFU_CSR_PACKET_DATA_SIZE -
|
FU_DFU_CSR_PACKET_DATA_SIZE -
|
||||||
FU_DFU_CSR_COMMAND_HEADER_SIZE);
|
FU_DFU_CSR_COMMAND_HEADER_SIZE);
|
||||||
|
if (chunks->len > G_MAXUINT16) {
|
||||||
|
g_set_error(error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_INVALID_FILE,
|
||||||
|
"too many chunks for hardware: 0x%x",
|
||||||
|
chunks->len);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* send to hardware */
|
/* send to hardware */
|
||||||
fu_progress_set_steps(progress, chunks->len);
|
fu_progress_set_steps(progress, chunks->len);
|
||||||
|
@ -313,7 +313,7 @@ fu_fresco_pd_device_write_firmware(FuDevice *device,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_debug("begin_addr: 0x%04x", begin_addr);
|
g_debug("begin_addr: 0x%04x", begin_addr);
|
||||||
for (guint16 i = begin_addr + 3; i < begin_addr + 0x400; i += 3) {
|
for (guint i = begin_addr + 3; i < (guint)begin_addr + 0x400; i += 3) {
|
||||||
for (guint j = 0; j < 3; j++) {
|
for (guint j = 0; j < 3; j++) {
|
||||||
if (!fu_fresco_pd_device_read_byte(self, i + j, &config[j], error)) {
|
if (!fu_fresco_pd_device_read_byte(self, i + j, &config[j], error)) {
|
||||||
g_prefix_error(error, "failed to read config byte %u: ", j);
|
g_prefix_error(error, "failed to read config byte %u: ", j);
|
||||||
|
@ -91,7 +91,7 @@ fu_synaptics_rmi_function_parse(GByteArray *buf,
|
|||||||
/* set an enable bit for each data source */
|
/* set an enable bit for each data source */
|
||||||
interrupt_offset = interrupt_count % 8;
|
interrupt_offset = interrupt_count % 8;
|
||||||
func->interrupt_mask = 0;
|
func->interrupt_mask = 0;
|
||||||
for (guint8 i = interrupt_offset;
|
for (guint i = interrupt_offset;
|
||||||
i < (func->interrupt_source_count + interrupt_offset);
|
i < (func->interrupt_source_count + interrupt_offset);
|
||||||
i++)
|
i++)
|
||||||
func->interrupt_mask |= 1 << i;
|
func->interrupt_mask |= 1 << i;
|
||||||
|
@ -94,7 +94,7 @@ fu_uefi_devpath_parse(const guint8 *buf, gsize sz, FuUefiDevpathParseFlags flags
|
|||||||
sz - offset,
|
sz - offset,
|
||||||
32,
|
32,
|
||||||
FU_DUMP_FLAGS_SHOW_ADDRESSES);
|
FU_DUMP_FLAGS_SHOW_ADDRESSES);
|
||||||
for (guint16 i = offset + 4; i <= sz - 4; i++) {
|
for (gsize i = offset + 4; i <= sz - 4; i++) {
|
||||||
if (memcmp(buf + i, "\x7f\xff\x04\x00", 4) == 0) {
|
if (memcmp(buf + i, "\x7f\xff\x04\x00", 4) == 0) {
|
||||||
hdr_length = i - offset;
|
hdr_length = i - offset;
|
||||||
g_debug("found END_ENTIRE at 0x%04x", (guint)(i - offset));
|
g_debug("found END_ENTIRE at 0x%04x", (guint)(i - offset));
|
||||||
|
@ -229,6 +229,15 @@ fu_wac_device_ensure_flash_descriptors(FuWacDevice *self, GError **error)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
g_ptr_array_add(self->flash_descriptors, fd);
|
g_ptr_array_add(self->flash_descriptors, fd);
|
||||||
}
|
}
|
||||||
|
if (self->flash_descriptors->len > G_MAXUINT16) {
|
||||||
|
g_set_error(error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_NOT_SUPPORTED,
|
||||||
|
"too many flash descriptors for hardware: 0x%x",
|
||||||
|
self->flash_descriptors->len);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
g_debug("added %u flash descriptors", self->flash_descriptors->len);
|
g_debug("added %u flash descriptors", self->flash_descriptors->len);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -507,7 +516,7 @@ fu_wac_device_write_firmware(FuDevice *device,
|
|||||||
fu_progress_step_done(progress);
|
fu_progress_step_done(progress);
|
||||||
|
|
||||||
/* clear all checksums of pages */
|
/* clear all checksums of pages */
|
||||||
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
for (guint i = 0; i < self->flash_descriptors->len; i++) {
|
||||||
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
||||||
if (fu_wav_device_flash_descriptor_is_wp(fd))
|
if (fu_wav_device_flash_descriptor_is_wp(fd))
|
||||||
continue;
|
continue;
|
||||||
@ -521,7 +530,7 @@ fu_wac_device_write_firmware(FuDevice *device,
|
|||||||
g_direct_equal,
|
g_direct_equal,
|
||||||
NULL,
|
NULL,
|
||||||
(GDestroyNotify)g_bytes_unref);
|
(GDestroyNotify)g_bytes_unref);
|
||||||
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
for (guint i = 0; i < self->flash_descriptors->len; i++) {
|
||||||
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
||||||
GBytes *blob_block;
|
GBytes *blob_block;
|
||||||
g_autoptr(GBytes) blob_tmp = NULL;
|
g_autoptr(GBytes) blob_tmp = NULL;
|
||||||
@ -540,7 +549,7 @@ fu_wac_device_write_firmware(FuDevice *device,
|
|||||||
|
|
||||||
/* write the data into the flash page */
|
/* write the data into the flash page */
|
||||||
csum_local = g_new0(guint32, self->flash_descriptors->len);
|
csum_local = g_new0(guint32, self->flash_descriptors->len);
|
||||||
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
for (guint i = 0; i < self->flash_descriptors->len; i++) {
|
||||||
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
||||||
GBytes *blob_block;
|
GBytes *blob_block;
|
||||||
g_autoptr(GPtrArray) chunks = NULL;
|
g_autoptr(GPtrArray) chunks = NULL;
|
||||||
@ -606,7 +615,7 @@ fu_wac_device_write_firmware(FuDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* calculate CRC inside device */
|
/* calculate CRC inside device */
|
||||||
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
for (guint i = 0; i < self->flash_descriptors->len; i++) {
|
||||||
if (!fu_wac_device_calculate_checksum_of_block(self, i, error))
|
if (!fu_wac_device_calculate_checksum_of_block(self, i, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -614,7 +623,7 @@ fu_wac_device_write_firmware(FuDevice *device,
|
|||||||
/* read all CRC of all pages and verify with local CRC */
|
/* read all CRC of all pages and verify with local CRC */
|
||||||
if (!fu_wac_device_ensure_checksums(self, error))
|
if (!fu_wac_device_ensure_checksums(self, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
for (guint16 i = 0; i < self->flash_descriptors->len; i++) {
|
for (guint i = 0; i < self->flash_descriptors->len; i++) {
|
||||||
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
FuWacFlashDescriptor *fd = g_ptr_array_index(self->flash_descriptors, i);
|
||||||
GBytes *blob_block;
|
GBytes *blob_block;
|
||||||
guint32 csum_rom;
|
guint32 csum_rom;
|
||||||
|
Loading…
Reference in New Issue
Block a user