public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ji-Hun Kim <ji_hun.kim@samsung.com>
To: gregkh@linuxfoundation.org, dan.carpenter@oracle.com, mchehab@kernel.org
Cc: arvind.yadav.cs@gmail.com, ji_hun.kim@samsung.com,
	linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v3 1/2] staging: media: davinci_vpfe: add error handling on kmalloc failure
Date: Tue, 27 Mar 2018 14:00:45 +0900	[thread overview]
Message-ID: <20180327050045.GA12754@ubuntu> (raw)
In-Reply-To: <1521607150-31307-1-git-send-email-ji_hun.kim@samsung.com>

On Wed, Mar 21, 2018 at 01:39:09PM +0900, Ji-Hun Kim wrote:
> There is no failure checking on the param value which will be allocated
> memory by kmalloc. Add a null pointer checking statement. Then goto error:
> and return -ENOMEM error code when kmalloc is failed.
> 
> Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>
> ---
> Changes since v1:
>   - Return with -ENOMEM directly, instead of goto error: then return.
>   - [Patch v3 1/2] is same with [patch v2]
> 
>  drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
> index 6a3434c..ffcd86d 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
> @@ -1280,6 +1280,9 @@ static int ipipe_s_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg)
>  
>  			params = kmalloc(sizeof(struct ipipe_module_params),
>  					 GFP_KERNEL);
> +			if (!params)
> +				return -ENOMEM;
> +
>  			to = (void *)params + module_if->param_offset;
>  			size = module_if->param_size;
>  
> @@ -1323,6 +1326,9 @@ static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg)
>  
>  			params =  kmalloc(sizeof(struct ipipe_module_params),
>  						GFP_KERNEL);
> +			if (!params)
> +				return -ENOMEM;
> +
>  			from = (void *)params + module_if->param_offset;
>  			size = module_if->param_size;
>  
> -- 
> 1.9.1
> 
> 

Are there any opinions? I'd like to know how this patch is going.

Best regards,
Ji-Hun

  parent reply	other threads:[~2018-03-27  5:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180321043915epcas1p3955f5a57c6728cd1f386f805879fc3f2@epcas1p3.samsung.com>
2018-03-21  4:39 ` [PATCH v3 1/2] staging: media: davinci_vpfe: add error handling on kmalloc failure Ji-Hun Kim
2018-03-21  4:39   ` [PATCH v3 2/2] staging: media: davinci_vpfe: add kfree() on goto err statement Ji-Hun Kim
2018-03-21  6:48     ` Dan Carpenter
2018-03-27  5:00   ` Ji-Hun Kim [this message]
2018-03-27  5:20     ` [PATCH v3 1/2] staging: media: davinci_vpfe: add error handling on kmalloc failure Dan Carpenter
2018-03-27  6:29       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180327050045.GA12754@ubuntu \
    --to=ji_hun.kim@samsung.com \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox