Re: [PATCH v2 09/14] config.c: provide kvi with CLI config

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

 



Jonathan Tan <jonathantanmy@xxxxxxxxxx> writes:

>> +	memcpy(&matched->kvi, kvi, sizeof(struct key_value_info));
>
> Can this just be
>
>   matched->kvi = *kvi;
>
> ?

If I remember correctly (big if), we have to copy the memory because the
config machinery allocates kvi on the stack, and the relevant functions
have returned by then. Hm, does this suggest that kvi should be const?

> If not, for the sizeof, use *kvi as the argument instead of struct
> key_value_info.

Makes sense.



[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