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>
This commit is contained in:
committed by
David S. Miller
parent
c7ad365761
commit
5a46b062e2
@@ -146,6 +146,21 @@ regions_test()
|
||||
|
||||
check_region_snapshot_count dummy post-first-request 3
|
||||
|
||||
devlink region dump $DL_HANDLE/dummy snapshot 25 >> /dev/null
|
||||
check_err $? "Failed to dump snapshot with id 25"
|
||||
|
||||
devlink region read $DL_HANDLE/dummy snapshot 25 addr 0 len 1 >> /dev/null
|
||||
check_err $? "Failed to read snapshot with id 25 (1 byte)"
|
||||
|
||||
devlink region read $DL_HANDLE/dummy snapshot 25 addr 128 len 128 >> /dev/null
|
||||
check_err $? "Failed to read snapshot with id 25 (128 bytes)"
|
||||
|
||||
devlink region read $DL_HANDLE/dummy snapshot 25 addr 128 len $((1<<32)) >> /dev/null
|
||||
check_err $? "Failed to read snapshot with id 25 (oversized)"
|
||||
|
||||
devlink region read $DL_HANDLE/dummy snapshot 25 addr $((1<<32)) len 128 >> /dev/null 2>&1
|
||||
check_fail $? "Bad read of snapshot with id 25 did not fail"
|
||||
|
||||
devlink region del $DL_HANDLE/dummy snapshot 25
|
||||
check_err $? "Failed to delete snapshot with id 25"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user