aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/google/vpd_decode.c
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2019-09-30 14:45:22 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-11 08:41:34 +0200
commit442f1e746e8187b9deb1590176f6b0ff19686b11 (patch)
tree1639715dda354da74a868977151f6be2c9bc15c5 /drivers/firmware/google/vpd_decode.c
parentw1: ds250x: Fix build error without CRC16 (diff)
downloadlinux-dev-442f1e746e8187b9deb1590176f6b0ff19686b11.tar.xz
linux-dev-442f1e746e8187b9deb1590176f6b0ff19686b11.zip
firmware: google: increment VPD key_len properly
Commit 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data") adds length checks, but the new vpd_decode_entry() function botched the logic -- it adds the key length twice, instead of adding the key and value lengths separately. On my local system, this means vpd.c's vpd_section_create_attribs() hits an error case after the first attribute it parses, since it's no longer looking at the correct offset. With this patch, I'm back to seeing all the correct attributes in /sys/firmware/vpd/... Fixes: 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data") Cc: <stable@vger.kernel.org> Cc: Hung-Te Lin <hungte@chromium.org> Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Link: https://lore.kernel.org/r/20190930214522.240680-1-briannorris@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r--drivers/firmware/google/vpd_decode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/google/vpd_decode.c b/drivers/firmware/google/vpd_decode.c
index dda525c0f968..5c6f2a74f104 100644
--- a/drivers/firmware/google/vpd_decode.c
+++ b/drivers/firmware/google/vpd_decode.c
@@ -52,7 +52,7 @@ static int vpd_decode_entry(const u32 max_len, const u8 *input_buf,
if (max_len - consumed < *entry_len)
return VPD_FAIL;
- consumed += decoded_len;
+ consumed += *entry_len;
*_consumed = consumed;
return VPD_OK;
}