]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: octeontx2: NULL check before dereference
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 5 Aug 2025 14:53:35 +0000 (15:53 +0100)
committerJerome Forissier <jerome.forissier@linaro.org>
Mon, 18 Aug 2025 13:47:57 +0000 (15:47 +0200)
In rvu_af_init if the code fails to allocate memory for nix_af it will
take the error path with nix_af == NULL which will dereference nix_af.
Add the appropriate NULL check.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/net/octeontx2/rvu_af.c

index 0d3a9ffe9ee18511d6c553d84e28a5c03b90fb4d..7bdfbc52e3b8bd14e6b78b7c7d15fa6dd7ecd65a 100644 (file)
@@ -114,7 +114,7 @@ struct nix_af *rvu_af_init(struct rvu_af *rvu_af)
        return nix_af;
 
 error:
-       if (nix_af->npa_af) {
+       if (nix_af && nix_af->npa_af) {
                free(nix_af->npa_af);
                memset(nix_af, 0, sizeof(*nix_af));
        }