datapath: Check for NULL upcall_portids.
authorPravin B Shelar <pshelar@nicira.com>
Tue, 15 Jul 2014 18:12:11 +0000 (11:12 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Tue, 15 Jul 2014 18:43:35 +0000 (11:43 -0700)
Following patch adds NULL check for memory allocated
by kmalloc.

Reported-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
datapath/vport.c

index ce46f5b..1d19b8a 100644 (file)
@@ -390,6 +390,9 @@ int ovs_vport_set_upcall_portids(struct vport *vport,  struct nlattr *ids)
 
        vport_portids = kmalloc(sizeof *vport_portids + nla_len(ids),
                                GFP_KERNEL);
+       if (!vport_portids)
+               return -ENOMEM;
+
        vport_portids->n_ids = nla_len(ids) / sizeof(u32);
        vport_portids->rn_ids = reciprocal_value(vport_portids->n_ids);
        nla_memcpy(vport_portids->ids, ids, nla_len(ids));