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

Commit 43477d2b authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher
Browse files

i40e: add range check to i40e_aq_rc_to_posix



Just to be sure, add a range check to avoid any possible
array index-out-of-bound issues.

CC: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Change-ID: I9323bee6732c2a47599816e1d6c6b3a1f8dcbf54
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Acked-by: default avatarMichal Kosiarz <michal.kosiarz@intel.com>
Tested-by: default avatarJim Young <jamesx.m.young@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 74d0d0ed
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -136,6 +136,8 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc)
		-EFBIG,      /* I40E_AQ_RC_EFBIG */
		-EFBIG,      /* I40E_AQ_RC_EFBIG */
	};
	};


	if (aq_rc >= ARRAY_SIZE(aq_to_posix))
		return -ERANGE;
	return aq_to_posix[aq_rc];
	return aq_to_posix[aq_rc];
}
}


+2 −0
Original line number Original line Diff line number Diff line
@@ -136,6 +136,8 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc)
		-EFBIG,      /* I40E_AQ_RC_EFBIG */
		-EFBIG,      /* I40E_AQ_RC_EFBIG */
	};
	};


	if (aq_rc >= ARRAY_SIZE(aq_to_posix))
		return -ERANGE;
	return aq_to_posix[aq_rc];
	return aq_to_posix[aq_rc];
}
}