rbd: check for overflow in rbd_get_num_segments()
The return type of rbd_get_num_segments() is int, but the values it operates on are u64. Although it's not likely, there's no guarantee the result won't exceed what can be respresented in an int. The function is already designed to return -ERANGE on error, so just add this possible overflow as another reason to return that. Signed-off-by: NAlex Elder <elder@inktank.com> Reviewed-by: NDan Mick <dan.mick@inktank.com> Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
Showing
想要评论请 注册 或 登录