Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25671044rwd; Sun, 2 Jul 2023 22:36:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFlabQqyYr3nvoUqsg1MuECxUooMHlCSVHcj7J0oZFhbmK7Ti9eygAq8gqTn3R+J9NSVLgf X-Received: by 2002:a05:6870:c985:b0:1b3:8fd0:1a7d with SMTP id hi5-20020a056870c98500b001b38fd01a7dmr3709058oab.14.1688362575473; Sun, 02 Jul 2023 22:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688362575; cv=none; d=google.com; s=arc-20160816; b=JCnXEL93M6Aqw1cVrkXRvBU/VIfrlR26RiF3ZFZRHkIOaTRjNPmN/GsbyTnrSsGZ7d 2bEIa8UPHwCOx+A9PECXTbFDhCMS4aP6moHbTuXLeo6JrxrXRs9SO8Zp1yZFEiF3PMoB RIsBIxqQl10DIc3GM8J4nzlKeEGMPHS0D2ZaHVom4CoEwtM0zpd6Mf1kXLJ9sI+TNjQ2 46tt87xo/zl0nEmQR1bIgHgPUDvWBNs+6iX8X0z+aROvPUoa9PQEh8/5XWmYh2gPsZzR 1KV6Th2Z87AyqJQGbh4gvjfxQrw9C1iXNGHxENQHgJh3oLOOGQONw7CmT0uY59qZppiW G1lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :message-id:subject:references:in-reply-to:cc:to:from; bh=6Z/qnJEG39CZf+ZhN0I7NOFs3Qp9Fz1svhaMM1+8Mtc=; fh=s/WvjkrhJn6MQGTBlpnczNc4SZ7eDiETKO8vUPzUUcY=; b=Y+l9y/hI8UNsAFVJcZAPNr/09AZ6XTHdGGS9s2U6weEmwdDFOJMpEuiut5hbelHEZ1 A7JM3xMHjX+rwsZPabQUGoYtYOgu7chu8TZUJOq7Z1eu7nyFNg38L2jUF/bJZtumz3h7 gdhdXj6dTRn098wQ7iWiJMxGLFhR7SEPxSqW9gUAfoipSTyyWev+05v/LLpgPY5pJi/q EyDoR8pdD+mDsomc2UNS35zRApH5PhSmDJwbjpypiRuzuAkHYknItQwE810FuHbw7Xc5 YJTTF2S+fvbc+6x8y+Z5w/9tiYMuSVQ6M9epVZg5XrVjnKvRtsvBf9KJ7y9yWW51gcZM oaBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q62-20020a17090a754400b0025eee012ca4si6448686pjk.30.2023.07.02.22.36.01; Sun, 02 Jul 2023 22:36:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjGCFes (ORCPT + 99 others); Mon, 3 Jul 2023 01:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbjGCFef (ORCPT ); Mon, 3 Jul 2023 01:34:35 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0F8A180; Sun, 2 Jul 2023 22:34:34 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4QvZP50w9Cz4wxq; Mon, 3 Jul 2023 15:34:33 +1000 (AEST) From: Michael Ellerman To: Nicholas Piggin , Christophe Leroy , Oliver O'Halloran , linuxppc-dev@lists.ozlabs.org, Colin Ian King Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230608095849.1147969-1-colin.i.king@gmail.com> References: <20230608095849.1147969-1-colin.i.king@gmail.com> Subject: Re: [PATCH][next] powerpc/powernv/sriov: perform null check on iov before dereferencing iov Message-Id: <168836201891.50010.6948846603017935484.b4-ty@ellerman.id.au> Date: Mon, 03 Jul 2023 15:26:58 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 08 Jun 2023 10:58:49 +0100, Colin Ian King wrote: > Currently pointer iov is being dereferenced before the null check of iov > which can lead to null pointer dereference errors. Fix this by moving the > iov null check before the dereferencing. > > Detected using cppcheck static analysis: > linux/arch/powerpc/platforms/powernv/pci-sriov.c:597:12: warning: Either > the condition '!iov' is redundant or there is possible null pointer > dereference: iov. [nullPointerRedundantCheck] > num_vfs = iov->num_vfs; > ^ > > [...] Applied to powerpc/next. [1/1] powerpc/powernv/sriov: perform null check on iov before dereferencing iov https://git.kernel.org/powerpc/c/f4f913c980bc6abe0ccfe88fe3909c125afe4a2d cheers