Re: [PATCH] drm/msm/adreno: Add a null pointer check in zap_shader_load_mdt()

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

 



> kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure. Ensure the allocation was successful
> by checking the pointer validity.
…
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -144,6 +144,10 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
>  		char *newname;
>
>  		newname = kasprintf(GFP_KERNEL, "qcom/%s", fwname);
> +		if (!newname) {
> +			ret = -ENOMEM;
> +			goto out;
> +		}
…

How do you think about to avoid the repetition of the pointer check
for the variable “mem_region”?
Can the usage of other labels become more appropriate?

Regards,
Markus





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux