Re: [PATCH bpf-next 3/4] selftests/bpf: Add a null pointer check for the load_btf_spec

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

 



…
> Add the malloc failure checking to avoid possible null
> dereference.
…

How do you think about the following wording variant?

   Add a return value check so that a null pointer dereference will be avoided
   after a memory allocation failure.


Would you like to add the tag “Fixes” accordingly?


…
> +++ b/tools/testing/selftests/bpf/test_verifier.c
> @@ -762,6 +762,8 @@ static int load_btf_spec(__u32 *types, int types_len,
>  	);
>
>  	raw_btf = malloc(sizeof(hdr) + types_len + strings_len);
> +	if (!raw_btf)
> +		return -ENOMEM;
…

How do you think about to reuse the variable “errno” in such an error case?

Regards,
Markus





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux