Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e65ad3be authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

rocker: add a check for NULL in rocker_probe_ports()



Make sure kmalloc() succeeds.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarScott Feldman <sfeldma@gmail.com>
Acked-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f01aa633
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4201,6 +4201,8 @@ static int rocker_probe_ports(struct rocker *rocker)

	alloc_size = sizeof(struct rocker_port *) * rocker->port_count;
	rocker->ports = kmalloc(alloc_size, GFP_KERNEL);
	if (!rocker->ports)
		return -ENOMEM;
	for (i = 0; i < rocker->port_count; i++) {
		err = rocker_probe_port(rocker, i);
		if (err)