summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2018-08-11 02:06:07 +0300
committerBen Hutchings <ben@decadent.org.uk>2018-12-17 01:09:16 +0300
commitf379eed7ab1e29c9d434e95aae1ddb718f3dd4c9 (patch)
treee30b0d1dc25c7d4e4cc7aad871b2767899911ff5
parente9eaa9870e763e81e83a1f970b27512311b15cff (diff)
downloadlinux-f379eed7ab1e29c9d434e95aae1ddb718f3dd4c9.tar.xz
Tools: hv: Fix a bug in the key delete code
commit 86503bd35dec0ce363e9fdbf5299927422ed3899 upstream. Fix a bug in the key delete code - the num_records range from 0 to num_records-1. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reported-by: David Binderman <dcb314@hotmail.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--tools/hv/hv_kvp_daemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index f660d3f69ce7..ac32a9234dd2 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -289,7 +289,7 @@ static int kvp_key_delete(int pool, const char *key, int key_size)
* Found a match; just move the remaining
* entries up.
*/
- if (i == num_records) {
+ if (i == (num_records - 1)) {
kvp_file_info[pool].num_records--;
kvp_update_file(pool);
return 0;