devlink: refactor end checks in devlink_nl_cmd_region_read_dumpit
authorJakub Kicinski <kuba@kernel.org>
Wed, 13 May 2020 17:28:22 +0000 (10:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 May 2020 00:36:25 +0000 (17:36 -0700)
commit5a46b062e28f57bffde767437fad3ab1d0cee2c7
treee8d48306ad9c6b0b870b0bfde28c847f44cae1ce
parentc7ad365761857ddc91c891ef7557d90f2510353e
devlink: refactor end checks in devlink_nl_cmd_region_read_dumpit

Clean up after recent fixes, move address calculations
around and change the variable init, so that we can have
just one start_offset == end_offset check.

Make the check a little stricter to preserve the -EINVAL
error if requested start offset is larger than the region
itself.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/devlink.c
tools/testing/selftests/drivers/net/netdevsim/devlink.sh