Skip to content

Commit

Permalink
firmware_loader: Fix a NULL vs IS_ERR() check
Browse files Browse the repository at this point in the history
The crypto_alloc_shash() function doesn't return NULL, it returns
error pointers.  Update the check accordingly.

Fixes: 02fe26f ("firmware_loader: Add debug message with checksum for FW file")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/36ef6042-ce74-4e8e-9e2c-5b5c28940610@kili.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed May 31, 2023
1 parent 71698da commit ffa2831
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/firmware_loader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ static void fw_log_firmware_info(const struct firmware *fw, const char *name, st
char *outbuf;

alg = crypto_alloc_shash("sha256", 0, 0);
if (!alg)
if (IS_ERR(alg))
return;

sha256buf = kmalloc(SHA256_DIGEST_SIZE, GFP_KERNEL);
Expand Down

0 comments on commit ffa2831

Please sign in to comment.