Skip to content

Commit c609048

Browse files
GustavoARSilvaherbertx
authored andcommitted
crypto: brcm - add NULL check on of_match_device() return value
Check return value from call to of_match_device() in order to prevent a NULL pointer dereference. In case of NULL print error message and return -ENODEV Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 24086e3 commit c609048

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/crypto/bcm/cipher.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4813,6 +4813,11 @@ static int spu_dt_read(struct platform_device *pdev)
48134813
int err;
48144814

48154815
match = of_match_device(of_match_ptr(bcm_spu_dt_ids), dev);
4816+
if (!match) {
4817+
dev_err(&pdev->dev, "Failed to match device\n");
4818+
return -ENODEV;
4819+
}
4820+
48164821
matched_spu_type = match->data;
48174822

48184823
if (iproc_priv.spu.num_spu > 1) {

0 commit comments

Comments
 (0)