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

Commit 822c2ee8 authored by Thomas Falcon's avatar Thomas Falcon Committed by Greg Kroah-Hartman
Browse files

ibmvnic: Fix unchecked return codes of memory allocations



[ Upstream commit 7c940b1a5291e5069d561f5b8f0e51db6b7a259a ]

The return values for these memory allocations are unchecked,
which may cause an oops if the driver does not handle them after
a failure. Fix by checking the function's return code.

Signed-off-by: default avatarThomas Falcon <tlfalcon@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0f06004d
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -438,7 +438,8 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
		if (rx_pool->buff_size != be64_to_cpu(size_array[i])) {
			free_long_term_buff(adapter, &rx_pool->long_term_buff);
			rx_pool->buff_size = be64_to_cpu(size_array[i]);
			alloc_long_term_buff(adapter, &rx_pool->long_term_buff,
			rc = alloc_long_term_buff(adapter,
						  &rx_pool->long_term_buff,
						  rx_pool->size *
						  rx_pool->buff_size);
		} else {
@@ -706,7 +707,7 @@ static int init_tx_pools(struct net_device *netdev)
			return rc;
		}

		init_one_tx_pool(netdev, &adapter->tso_pool[i],
		rc = init_one_tx_pool(netdev, &adapter->tso_pool[i],
				      IBMVNIC_TSO_BUFS,
				      IBMVNIC_TSO_BUF_SZ);
		if (rc) {