[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220315170538.GR3293@kadam>
Date: Tue, 15 Mar 2022 20:05:38 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: xkernel.wang@...mail.com
Cc: gregkh@...uxfoundation.org, nsaenz@...nel.org,
bcm-kernel-feedback-list@...adcom.com,
linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] staging: mmal-vchiq: add a check for the return of
vmalloc()
On Wed, Mar 16, 2022 at 12:39:13AM +0800, xkernel.wang@...mail.com wrote:
> From: Xiaoke Wang <xkernel.wang@...mail.com>
>
> vmalloc() is a memory allocation API which can return NULL when some
> internal memory errors happen. So it is better to check the return
> value of it to catch the error in time.
>
> Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
> ---
> ChangeLog:
> v1->v2 jump to the proper location and remove redundant instruction.
> v2->v3 fix the mistake bring by version 2.
> drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> index 76d3f03..24cc0fe 100644
> --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> @@ -1909,6 +1909,10 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
> mutex_init(&instance->vchiq_mutex);
>
> instance->bulk_scratch = vmalloc(PAGE_SIZE);
> + if (!instance->bulk_scratch) {
Just delete ->bulk_scratch. It is not used anywhere.
regards,
dan carpenter
Powered by blists - more mailing lists