This patch checks if the kmalloc in match_strdup was successful. Signed-off-by: Ishai Rabinovitz <[EMAIL PROTECTED]> --- Index: gen2_devel_kernel/drivers/infiniband/ulp/srp/ib_srp.c =================================================================== --- gen2_devel_kernel.orig/drivers/infiniband/ulp/srp/ib_srp.c 2007-01-16 16:12:02.000000000 +0200 +++ gen2_devel_kernel/drivers/infiniband/ulp/srp/ib_srp.c 2007-01-16 16:48:24.000000000 +0200 @@ -1627,18 +1627,30 @@ static int srp_parse_options(const char switch (token) { case SRP_OPT_ID_EXT: p = match_strdup(args); + if (!p) { + ret = -ENOMEM; + goto out; + } target->id_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); kfree(p); break; case SRP_OPT_IOC_GUID: p = match_strdup(args); + if (!p) { + ret = -ENOMEM; + goto out; + } target->ioc_guid = cpu_to_be64(simple_strtoull(p, NULL, 16)); kfree(p); break; case SRP_OPT_DGID: p = match_strdup(args); + if (!p) { + ret = -ENOMEM; + goto out; + } if (strlen(p) != 32) { printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p); kfree(p); @@ -1662,6 +1674,10 @@ static int srp_parse_options(const char case SRP_OPT_SERVICE_ID: p = match_strdup(args); + if (!p) { + ret = -ENOMEM; + goto out; + } target->service_id = cpu_to_be64(simple_strtoull(p, NULL, 16)); kfree(p); break; @@ -1699,6 +1715,10 @@ static int srp_parse_options(const char case SRP_OPT_INITIATOR_EXT: p = match_strdup(args); + if (!p) { + ret = -ENOMEM; + goto out; + } target->initiator_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); kfree(p); break;
_______________________________________________ openib-general mailing list openib-general@openib.org http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general