Miscellaneous patches for 2018-06-13

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJbIRNnAAoJEDhwtADrkYZTUegP/26bCanBdGq8NEH18EdzXU6u
 OZ5Xzx+ZvZCCsLJ3C+m+rxB82eEMVJq5Pj9/Sp/OP/Rebbj+JlGZDzV51T3KCmoA
 VxJ89mKCuDTC5Bqcac41AdDT0d9XkkiwTQNtbTzJwXef9TCygthpvzk4DeE2IfQB
 oYuMfeFt93xPXVuNUyUAHuVY5Z0uVeyRWZyqQ354leD53k0qO5TG0f87h7Awx7Cc
 mXgP6yMqBTBb4WnhHfhagg0TdSXr3OlXJ+265/2bpTNdbVz1e0dTjCU28ej1rmpw
 z01oZCrB1cCSoOrz9jNMG+HGmbarwbQ7EBwRZQZK5V89W8TiBKHdt7MIFlbgnTNI
 HK2RCh92X3ndk01vOn029yk4wYJhj3XNmKfIoWzBal+SIkd9BlJ92xckD7Iso9Pm
 WLf+DNCa46x+yiA+UXHdLmxZEGkclPnRvxW8Iz1l61iHjc3bW/ApWAMjQNPMJ1Vh
 4exOV+iisnrzaJZn4kfNnQXwTawDj/c11XxwwLOvk9NUPZBOIFm4PjX+hsXZSfuS
 8cxACWC+EvIFeOIN1fX2DQHyhdjYT976dIi+jMsxipGo1Ob9D8+oArUsKN5SWWkq
 O8+lwbkT02T7WmWuexRbgmkon/LDbjwDBGGdTjdcIutJUCu7KmPgHqLzd6SXHTPT
 jjYi0bmiI/pQY72+F8vZ
 =2uvo
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-06-13' into staging

Miscellaneous patches for 2018-06-13

# gpg: Signature made Wed 13 Jun 2018 13:51:51 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-misc-2018-06-13:
  Purge uses of banned g_assert_FOO()
  coverity-model: replay data is considered trusted
  Revert "Makefile: add target to print generated files"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-06-14 11:35:22 +01:00
commit 945741da77
7 changed files with 26 additions and 17 deletions

View File

@ -1055,9 +1055,6 @@ endif
include $(SRC_PATH)/tests/docker/Makefile.include
include $(SRC_PATH)/tests/vm/Makefile.include
printgen:
@echo $(GENERATED_FILES)
.PHONY: help
help:
@echo 'Generic targets:'

View File

@ -440,7 +440,7 @@ static uint64_t ahci_mem_read(void *opaque, hwaddr addr, unsigned size)
if (ofst + size <= 4) {
val = lo >> (ofst * 8);
} else {
g_assert_cmpint(size, >, 1);
g_assert(size > 1);
/* If the 64bit read is unaligned, we will produce undefined
* results. AHCI does not support unaligned 64bit reads. */

View File

@ -113,7 +113,7 @@ void spapr_ovec_cleanup(sPAPROptionVector *ov)
void spapr_ovec_set(sPAPROptionVector *ov, long bitnr)
{
g_assert(ov);
g_assert_cmpint(bitnr, <, OV_MAXBITS);
g_assert(bitnr < OV_MAXBITS);
set_bit(bitnr, ov->bitmap);
}
@ -121,7 +121,7 @@ void spapr_ovec_set(sPAPROptionVector *ov, long bitnr)
void spapr_ovec_clear(sPAPROptionVector *ov, long bitnr)
{
g_assert(ov);
g_assert_cmpint(bitnr, <, OV_MAXBITS);
g_assert(bitnr < OV_MAXBITS);
clear_bit(bitnr, ov->bitmap);
}
@ -129,7 +129,7 @@ void spapr_ovec_clear(sPAPROptionVector *ov, long bitnr)
bool spapr_ovec_test(sPAPROptionVector *ov, long bitnr)
{
g_assert(ov);
g_assert_cmpint(bitnr, <, OV_MAXBITS);
g_assert(bitnr < OV_MAXBITS);
return test_bit(bitnr, ov->bitmap) ? true : false;
}
@ -186,7 +186,7 @@ sPAPROptionVector *spapr_ovec_parse_vector(target_ulong table_addr, int vector)
int i;
g_assert(table_addr);
g_assert_cmpint(vector, >=, 1); /* vector numbering starts at 1 */
g_assert(vector >= 1); /* vector numbering starts at 1 */
addr = vector_addr(table_addr, vector);
if (!addr) {
@ -195,7 +195,7 @@ sPAPROptionVector *spapr_ovec_parse_vector(target_ulong table_addr, int vector)
}
vector_len = ldub_phys(&address_space_memory, addr++) + 1;
g_assert_cmpint(vector_len, <=, OV_MAXBYTES);
g_assert(vector_len <= OV_MAXBYTES);
ov = spapr_ovec_new();
for (i = 0; i < vector_len; i++) {
@ -225,7 +225,7 @@ int spapr_ovec_populate_dt(void *fdt, int fdt_offset,
* encoding/sizing expected in ibm,client-architecture-support
*/
vec_len = (lastbit == OV_MAXBITS) ? 1 : lastbit / BITS_PER_BYTE + 1;
g_assert_cmpint(vec_len, <=, OV_MAXBYTES);
g_assert(vec_len <= OV_MAXBYTES);
/* guest expects vector len encoded as vec_len - 1, since the length byte
* is assumed and not included, and the first byte of the vector
* is assumed as well

View File

@ -786,7 +786,7 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
DPRINTF(s, D_VERBOSE, "error %d\n", p->b.bError);
}
if (len) {
g_assert_nonnull(data);
assert(data);
memcpy(p->abData, data, len);
}
ccid_reset_error_status(s);

View File

@ -295,7 +295,7 @@ static void type_initialize(TypeImpl *ti)
GSList *e;
int i;
g_assert_cmpint(parent->class_size, <=, ti->class_size);
g_assert(parent->class_size <= ti->class_size);
memcpy(ti->class, parent->class, parent->class_size);
ti->class->interfaces = NULL;
ti->class->properties = g_hash_table_new_full(
@ -372,9 +372,9 @@ static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
g_assert(type != NULL);
type_initialize(type);
g_assert_cmpint(type->instance_size, >=, sizeof(Object));
g_assert(type->instance_size >= sizeof(Object));
g_assert(type->abstract == false);
g_assert_cmpint(size, >=, type->instance_size);
g_assert(size >= type->instance_size);
memset(obj, 0, type->instance_size);
obj->class = type->class;
@ -475,7 +475,7 @@ static void object_finalize(void *data)
object_property_del_all(obj);
object_deinit(obj, ti);
g_assert_cmpint(obj->ref, ==, 0);
g_assert(obj->ref == 0);
if (obj->free) {
obj->free(obj);
}
@ -917,7 +917,7 @@ void object_unref(Object *obj)
if (!obj) {
return;
}
g_assert_cmpint(obj->ref, >, 0);
g_assert(obj->ref > 0);
/* parent always holds a reference to its children */
if (atomic_fetch_dec(&obj->ref) == 1) {

View File

@ -103,6 +103,18 @@ static int get_keysym(const name2keysym_t *table,
}
}
/* Replay data is considered trusted. */
uint8_t replay_get_byte(void)
{
uint8_t byte = 0;
if (replay_file) {
uint8_t c;
byte = c;
}
return byte;
}
/*
* GLib memory allocation functions.
*

View File

@ -759,7 +759,7 @@ static void qht_do_resize_reset(struct qht *ht, struct qht_map *new, bool reset)
return;
}
g_assert_cmpuint(new->n_buckets, !=, old->n_buckets);
g_assert(new->n_buckets != old->n_buckets);
qht_map_iter__all_locked(ht, old, qht_map_copy, new);
qht_map_debug__all_locked(new);