Commit 98135552 authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Kleber Sacilotto de Souza

Tools: hv: Fix a bug in the key delete code

BugLink: https://bugs.launchpad.net/bugs/1798587

commit 86503bd3 upstream.

Fix a bug in the key delete code - the num_records range
from 0 to num_records-1.
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent cb06e37a
......@@ -286,7 +286,7 @@ static int kvp_key_delete(int pool, const __u8 *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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment