Re: [PATCH v3 10/12] config.c: remove config_reader from configsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Tan <jonathantanmy@xxxxxxxxxx> writes:

> "Glen Choo via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
>> @@ -2429,11 +2427,7 @@ static int configset_add_value(const struct key_value_info *kvi_p,
>>  	l_item->e = e;
>>  	l_item->value_index = e->value_list.nr - 1;
>>  
>> -	if (reader->source->name) {
>> -		kvi_from_source(reader->source, kvi_p->scope, kv_info);
>> -	} else {
>> -		kvi_from_param(kv_info);
>> -	}
>> +	memcpy(kv_info, kvi_p, sizeof(struct key_value_info));
>>  	si->util = kv_info;
>>  
>>  	return 0;
>
> Ah, I remember seeing this memcpy from the previous round, but forgot to
> comment on it (I only commented on another instance, [1]).

Yeah, I noticed this and recalled seeing a comment on structure
assignment.  As both are pointers,

    *kv_info = *kvi_p;

would sufficiently stand out to notify us that we are doing a
not-trivial assignment here, and would avoid (slight) risks of typos
by type checking.

> Other than that, up to here looks good.
>
> [1] https://lore.kernel.org/git/20230601233550.429921-1-jonathantanmy@xxxxxxxxxx/
>  



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux