ANDROID: dm: android-verity: fix table_make_digest() error handling
authorGreg Hackmann <ghackmann@google.com>
Mon, 14 Nov 2016 17:48:02 +0000 (09:48 -0800)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000 (21:11 +0530)
If table_make_digest() fails, verify_verity_signature() would try to
pass the returned ERR_PTR() to kfree().

This fixes the smatch error:

drivers/md/dm-android-verity.c:601 verify_verity_signature() error: 'pks' dereferencing possible ERR_PTR()

Change-Id: I9b9b7764b538cb4a5f94337660e9b0f149b139be
Signed-off-by: Greg Hackmann <ghackmann@google.com>
drivers/md/dm-android-verity.c

index 6f616fdf3b736db270256627f585606def327bbf..ac73db367d1707b528602a8a6d673c67a87b6f77 100644 (file)
@@ -585,6 +585,8 @@ static int verify_verity_signature(char *key_id,
 
        if (IS_ERR(pks)) {
                DMERR("hashing failed");
+               retval = PTR_ERR(pks);
+               pks = NULL;
                goto error;
        }