Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1878597iob; Thu, 19 May 2022 17:37:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi2svSEde4qr8E6vZjGxi9G5XSWFvCmdKYWz/ILjxKKxHKvFnKd028wKD+xzQ0PG5+lv+x X-Received: by 2002:a17:90b:1642:b0:1dc:6419:43ff with SMTP id il2-20020a17090b164200b001dc641943ffmr7901221pjb.229.1653007054238; Thu, 19 May 2022 17:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653007054; cv=none; d=google.com; s=arc-20160816; b=oZcS2SKpAmVcbAEVDbkpnci5PRgjUbjfvUt/zQVohzBqFtuC2wSkkl6S+AYb5C6Mgf YtmNc4ouK5BUn9vQQThsKAbMg7I1/m7eurHZBfdbvKGQ1xPLH8xECRr7toKiMmZaMxTP 4x0jmJzqv4TL85yS/YPXzKJZkvLxgOqpd/WGDXBJyO8AYHzjtxjSJ+WsjmrjOqMn796R R5ZRKzpW25oEj+QKIqFRgPPVikJ7NRys6+8O9onLw2uIbThHnOwzRfaDdVzPkSaCaVg9 1wuTpopaYYwp1IfEEoERE+hDuJOvEDPqy86n2EZjbMCh+/Lxp0VZVH6EANbckfJGMCqH kKTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=OVcbo6U3F9cLqsdxveynl1uoNlkIyHMvRA/B5oC2p1I=; b=yD0h6RfX74VI856NH0lMR3fgQIHEwcGPhWbIIVQueR49PiURPFRG0angkhv88RWsZ/ R2PK5M2i5CbHQ7i/J2YRPjaTnu5BwojGDIp2f+NEcDBWNo7i50wEgLYfA1Tj2ENXeGs+ evstxZZmlZmMjfKB7DvsE3wFwAxISUtFL/FtUzD1yoyge+HO8Om+aJ4mO12L+cmjwgLW ix/H9Vy61bv7raBx4njlAD2077l7r/chEPEQiof1YFWJ8YZX/AzxIF4i7PbnvE0a1a4m L4a6UO4SgeCCh5tyO3pqxlY9BwvbkyOqxtNtxzXPZxPEdT31DgHEE2jvryerWA6UwM3V 7UDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BSNGYMUR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl16-20020a17090b385000b001cac1e802d5si1335594pjb.82.2022.05.19.17.37.21; Thu, 19 May 2022 17:37:34 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BSNGYMUR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234162AbiESPig (ORCPT + 99 others); Thu, 19 May 2022 11:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241288AbiESPiE (ORCPT ); Thu, 19 May 2022 11:38:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D593F134E; Thu, 19 May 2022 08:37:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 566CAB82567; Thu, 19 May 2022 15:37:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D965C385AA; Thu, 19 May 2022 15:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652974646; bh=aAtk0AWz5blwGH/xbY2AZCKKKj5atoROs7ScmIJsrOA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=BSNGYMURKhzbRfYy3fPbyDRgLaysOagNKV26sKM44XzSnTQfxxozioFUtTrFkDthd Wtf/EAPVvsCwYn9WK8Csu2xyMtHpRKhBZy7CPXOACCFivxn+3fOthkWJf/8RDS4Xyp eObEXJMJZ7qu0m0J7THkNS5kIfxCkLTatyvqhx9eSMu3cDvaPAlwVzg4VvGVFFELrg Myybjonz21ju/df1hEZ01bdx1TIdDXMYSRoV7v8OR43X6+rq5f81N6KasTWB4b5rWk A0OxFhgo9Gp4dHRaBZMqXuQwuB4t19lcyND5QoDKHSabNuBnljy1J3z804nclRXo1P 81Ju9PWhtdKRg== From: Kalle Valo To: Yongzhi Liu Cc: amitkarwar@gmail.com, ganapathi017@gmail.com, sharvari.harisangam@nxp.com, huxinming820@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, arend.vanspriel@broadcom.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, fuyq@stu.pku.edu.cn Subject: Re: [PATCH] mwifiex: Fix potential dereference of NULL pointer References: <1652957839-127949-1-git-send-email-lyz_cs@pku.edu.cn> Date: Thu, 19 May 2022 18:37:19 +0300 In-Reply-To: <1652957839-127949-1-git-send-email-lyz_cs@pku.edu.cn> (Yongzhi Liu's message of "Thu, 19 May 2022 03:57:19 -0700") Message-ID: <87r14p1qkw.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 Yongzhi Liu writes: > If 'card' is not valid, then we need to check the > field 'adapter' and 'priv_num' to avoid use of NULL > pointer in function 'mwifiex_get_priv'. Fix this by > adding the null pointer check on them. Why? We don't add null checks for every access, why does this function need it? How did you find this? Is this something you found with a static checker tool or by testing with a real device? > Fixes: 21c5c83ce ("mwifiex: support sysfs initiated device coredump") Format is wrong, it should be: Fixes: 21c5c83ce833 ("mwifiex: support sysfs initiated device coredump") -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches