From patchwork Tue Mar 19 00:58:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Pakki X-Patchwork-Id: 10859679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9A5115AC for ; Tue, 19 Mar 2019 14:29:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C40B283CA for ; Tue, 19 Mar 2019 14:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90603284BF; Tue, 19 Mar 2019 14:29:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1E12283CA for ; Tue, 19 Mar 2019 14:29:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 29CFD87E; Tue, 19 Mar 2019 15:28:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 29CFD87E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1553005774; bh=NikKZLqsX/BnPMGHJMkceXsrKRtmGOeGXuHByqq4x48=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=RuU0ddiZZ2w5/p+kSOhXbqjl/sbzXMnYVvNgJNy2cCp5gxVbhwMtVUm8j3YUUBwmV jMDXIYskMpmXfJSYtaXLeBEtyg5aAhdEs3aPArhuzBRYAq8IlxRID4sV2hdiWmn06w CZVBHp1LFb24X5/aXGsV5hlop4wh6pbXBJf32DHI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 41F01F89717; Tue, 19 Mar 2019 15:26:17 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id C6396F80C0B; Tue, 19 Mar 2019 01:58:18 +0100 (CET) Received: from mta-p5.oit.umn.edu (mta-p5.oit.umn.edu [134.84.196.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0916EF80709 for ; Tue, 19 Mar 2019 01:58:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0916EF80709 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=umn.edu header.i=@umn.edu header.b="I/gX11nR" Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 94CF2B39 for ; Tue, 19 Mar 2019 00:58:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mNbOzvCz-fJJ for ; Mon, 18 Mar 2019 19:58:12 -0500 (CDT) Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 6AC2D7B9 for ; Mon, 18 Mar 2019 19:58:11 -0500 (CDT) Received: by mail-io1-f69.google.com with SMTP id n15so14996982ioc.0 for ; Mon, 18 Mar 2019 17:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=EXT644PQkCBEG/dhZ8I2hNm6TfAQA6jwWJOLS+hChA4=; b=I/gX11nR8IEHnYe0d2pXhNP1H1NEKzD2aRItZqZNODp1/59LAqu67FgKRhzV8f4bpH Js0aRcsxCaRwY2GA03Wb8MnL+h4fRFwNLHIouegt+U18DjBVmFZzop6FdV88dCD2ceHl y5oh2bQOzfcNazSTnF6E6F43jBtHlelTOOxy7MC2pyE9tTZuMcvCvOZCUOtAO7VYjtHX oGnhYcj96+PZwd5YHRnvUmpDS9h2a+Zr4WeBSBUyjxeC5S56jDe0OUV1aFLn6T43KkYP D4DkLFov37y2LJ/u6b0RiOo+ffSQoTJwXJyG9pi9j4ra9M13oubDjaxz4d2H/NWCdUBp 5inQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EXT644PQkCBEG/dhZ8I2hNm6TfAQA6jwWJOLS+hChA4=; b=n6XLdCBSVOvHBxPyQ8fcihY8ntUX89/4/fs9qOMc/Xao4TPVW9a7E95zGyJxzZD4HC BN+4TcSt2mFDmlQG5SjBcxmQAUFQ+uCrLGx1OmDp1uAjlqWkLubIucCfmOjjdhgdF4JC e6ofBB/+4A5Ayk0fsVj9wO7EdaBHEccEPXdMx1NBXVR48hHqAhuCxa40xef2u5HGz2Go EtCQWmE/koTWvLWNVsnyh5J3/qZCTn0b/Qr5Mb6UOMhQZoPcAM5k3/0D5aIQ6SX4eZIP 7muhRh9VMF4UyaZGrp7zwZ6WqnaqROBKmbG3Pff6+6aPS/W6NApYTM82NtONySAqPURO Y7Iw== X-Gm-Message-State: APjAAAVJqlogUB4A70A1yc8rEh/GYjmoDv+v4EqtoH8/qEE2n2Wxe3vk m0Eqd3XrcN7QXdMLcnHqWBq/ZeTHo/QnuW+uS2yYE8VrciuEivHBchwwzHP1T5PSM3Km6nXdbLQ 6jPs/yaBEtcnogaxgWgOrOJqmeI0= X-Received: by 2002:a24:fc01:: with SMTP id b1mr1115131ith.104.1552957091607; Mon, 18 Mar 2019 17:58:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRkCEaTsHfrf5glbuyZk1++jz2MrzAh86/F71pokK7BXyHy1oGIKbyQ3AX/1giUyAnF/1BiQ== X-Received: by 2002:a24:fc01:: with SMTP id b1mr1115124ith.104.1552957091440; Mon, 18 Mar 2019 17:58:11 -0700 (PDT) Received: from lenovo-1.hsd1.mn.comcast.net (c-73-242-25-233.hsd1.mn.comcast.net. [73.242.25.233]) by smtp.googlemail.com with ESMTPSA id w19sm507831ita.33.2019.03.18.17.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 17:58:10 -0700 (PDT) From: Aditya Pakki To: pakki001@umn.edu Date: Mon, 18 Mar 2019 19:58:01 -0500 Message-Id: <20190319005805.13823-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Tue, 19 Mar 2019 15:26:12 +0100 Cc: Barry Song , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, kjlu@umn.edu, Takashi Iwai , Liam Girdwood , Mark Brown , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH] ASoC: codecs: Fix to avoid potential NULL pointer dereferences X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP In sirf_audio_codec_driver_probe, of_match_node may fail and return a NULL pointer. The patch avoids a potential NULL pointer dereference. Signed-off-by: Aditya Pakki --- sound/soc/codecs/sirf-audio-codec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/sirf-audio-codec.c b/sound/soc/codecs/sirf-audio-codec.c index e424499a8450..fd2bbd6a3c58 100644 --- a/sound/soc/codecs/sirf-audio-codec.c +++ b/sound/soc/codecs/sirf-audio-codec.c @@ -464,6 +464,8 @@ static int sirf_audio_codec_driver_probe(struct platform_device *pdev) const struct of_device_id *match; match = of_match_node(sirf_audio_codec_of_match, pdev->dev.of_node); + if (!match) + return -ENXIO; sirf_audio_codec = devm_kzalloc(&pdev->dev, sizeof(struct sirf_audio_codec), GFP_KERNEL);