summaryrefslogtreecommitdiff
path: root/sound/ppc/pmac.h
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-08-09 17:33:26 (GMT)
committerAlex Elder <elder@inktank.com>2012-10-01 19:30:50 (GMT)
commitdf111be6310fc41d059a485368e3c51a684859c2 (patch)
treede37a2197572af73ea74bdf1891b609719249a7f /sound/ppc/pmac.h
parent38f5f65e9d25b0a7270c337a35c724ca3d56f4d8 (diff)
downloadlinux-df111be6310fc41d059a485368e3c51a684859c2.tar.xz
rbd: check for overflow in rbd_get_num_segments()
It is possible in rbd_get_num_segments() for an overflow to occur when adding the offset and length. This is easily avoided. Since the function returns an int and the one caller is already prepared to handle errors, have it return -ERANGE if overflow would occur. The overflow check would not work if a zero-length request was being tested, so short-circuit that case, returning 0 for the number of segments required. (This condition might be avoided elsewhere already, I don't know.) Have the caller end the request if either an error or 0 is returned. The returned value is passed to __blk_end_request_all(), meaning a 0 length request is not treated an error. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Diffstat (limited to 'sound/ppc/pmac.h')
0 files changed, 0 insertions, 0 deletions