public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: obd: check for allocation failure
@ 2017-08-23  6:51 Dan Carpenter
  2017-08-23 23:22 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-08-23  6:51 UTC (permalink / raw)
  To: lustre-devel

lustre_cfg_new() can fail with ERR_PTR(-ENOMEM) so we should check for
that.

Fixes: d7e09d0397e8 ("staging: add Lustre file system client support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 8e0d4b1d86dc..7cb99f11caa0 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -159,6 +159,8 @@ static int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
 		lustre_cfg_bufs_set_string(&bufs, 4, s4);
 
 	lcfg = lustre_cfg_new(cmd, &bufs);
+	if (IS_ERR(lcfg))
+		return PTR_ERR(lcfg);
 	lcfg->lcfg_nid = nid;
 	rc = class_process_config(lcfg);
 	lustre_cfg_free(lcfg);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: lustre: obd: check for allocation failure
  2017-08-23  6:51 [PATCH] staging: lustre: obd: check for allocation failure Dan Carpenter
@ 2017-08-23 23:22 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2017-08-23 23:22 UTC (permalink / raw)
  To: lustre-devel

On Wed, Aug 23, 2017 at 09:51:31AM +0300, Dan Carpenter wrote:
> lustre_cfg_new() can fail with ERR_PTR(-ENOMEM) so we should check for
> that.
> 
> Fixes: d7e09d0397e8 ("staging: add Lustre file system client support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> index 8e0d4b1d86dc..7cb99f11caa0 100644
> --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> @@ -159,6 +159,8 @@ static int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
>  		lustre_cfg_bufs_set_string(&bufs, 4, s4);
>  
>  	lcfg = lustre_cfg_new(cmd, &bufs);
> +	if (IS_ERR(lcfg))
> +		return PTR_ERR(lcfg);
>  	lcfg->lcfg_nid = nid;
>  	rc = class_process_config(lcfg);
>  	lustre_cfg_free(lcfg);

Doesn't apply to my tree anymore :(

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-23 23:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-23  6:51 [PATCH] staging: lustre: obd: check for allocation failure Dan Carpenter
2017-08-23 23:22 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox