Commit e06aa69d authored by Giuliano Procida's avatar Giuliano Procida Committed by Masahiro Yamada
Browse files

gendwarfksyms: use preferred form of sizeof for allocation



The preferred form is to use the variable being allocated to, rather
than explicitly supplying a type name which might become stale.

Also do this for memset.

Suggested-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Signed-off-by: default avatarGiuliano Procida <gprocida@google.com>
Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 87433e3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ void cache_set(struct cache *cache, unsigned long key, int value)
{
	struct cache_item *ci;

	ci = xmalloc(sizeof(struct cache_item));
	ci = xmalloc(sizeof(*ci));
	ci->key = key;
	ci->value = value;
	hash_add(cache->cache, &ci->hash, hash_32(key));
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ static struct die *create_die(Dwarf_Die *die, enum die_state state)
{
	struct die *cd;

	cd = xmalloc(sizeof(struct die));
	cd = xmalloc(sizeof(*cd));
	init_die(cd);
	cd->addr = (uintptr_t)die->addr;

@@ -123,7 +123,7 @@ static struct die_fragment *append_item(struct die *cd)
{
	struct die_fragment *df;

	df = xmalloc(sizeof(struct die_fragment));
	df = xmalloc(sizeof(*df));
	df->type = FRAGMENT_EMPTY;
	list_add_tail(&df->list, &cd->fragments);
	return df;
+1 −1
Original line number Diff line number Diff line
@@ -634,7 +634,7 @@ static int get_union_kabi_status(Dwarf_Die *die, Dwarf_Die *placeholder,
	 * Note that the user of this feature is responsible for ensuring
	 * that the structure actually remains ABI compatible.
	 */
	memset(&state.kabi, 0, sizeof(struct kabi_state));
	memset(&state.kabi, 0, sizeof(state.kabi));

	res = checkp(process_die_container(&state, NULL, die,
					   check_union_member_kabi_status,
+1 −1
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ void kabi_read_rules(int fd)
		if (type == KABI_RULE_TYPE_UNKNOWN)
			error("unsupported kABI rule type: '%s'", field);

		rule = xmalloc(sizeof(struct rule));
		rule = xmalloc(sizeof(*rule));

		rule->type = type;
		rule->target = xstrdup(get_rule_field(&rule_str, &left));
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ void symbol_read_exports(FILE *file)
			continue;
		}

		sym = xcalloc(1, sizeof(struct symbol));
		sym = xcalloc(1, sizeof(*sym));
		sym->name = name;
		sym->addr.section = SHN_UNDEF;
		sym->state = SYMBOL_UNPROCESSED;
Loading