Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2389888imm; Thu, 14 Jun 2018 13:32:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJTlfbP9rC6n4V+MFF+VrnYonyNFQNRHhoSP57IRU2XGBRIvEjBBZcAb0qIZ+qcr5jmGTdH X-Received: by 2002:a62:9385:: with SMTP id r5-v6mr10980602pfk.59.1529008353699; Thu, 14 Jun 2018 13:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529008353; cv=none; d=google.com; s=arc-20160816; b=0KKPwBZqpYak5Wp4p1aQr6q8AhD556/Z0uo9c6OtxJX9QpaxzwFan4PCmAF/XVexDM U8pen3EjLjv3RllGao8ku2C99wzElvMwhg0/EtqALPjiI+ecxUQcgGpZ086mQx4gWlHW 4PxcI7sdElZjrEW6WMuy451EkvT3l7yOlae2lgUW4Saz//5R4pJyl2NxadGscO1gw0Ht fBuE6tdwvHEo5b92NEXjzMaTUPxhOD59f8TZyiybgmGqmRkeA2aFWAWnuFiaDAnGiK2h oWYRvn7frmFJBJ6c7ho67iDwMNEer7gRbf8pWjEOtee3I93SMYiOVptVtc2ZTzEtVlWq dp3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=cWhwXgX0H/4LBeqGgsmdRAVmtYeX6gotDwpvdxcDw0c=; b=TYPdQYxRrRcVqJogVBqmcmbtb51xBhiCEljnuVbgQCxqy5Y9KGDu+xBFUO35DPUULf nLeSutB8acxS8dR7twor1wdpfrqgL2fVXvxcZsPChYK/3nLP9o2YxihrCjOSU0+hMy60 LsZOusHRaluEH4FIvl9xIZIFETxke69xdLrlP3cX7PAqcPkLmb77vxe+xES3YcV0RDT5 tZzwEwVizQ6FL96zqXwEKQVHeNwroLEM5Mlbf6fZ0aPSvoABOnHgbOIrj8HY9kCFefwm f0iSiCf6hDTO8ExtDlPgkJInCUAVXFJjF1A7bsSXpMIzHAQaKISuv3h7djo7DiNWCkmf OXDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uLuImVj5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9-v6si5084560pgf.497.2018.06.14.13.32.17; Thu, 14 Jun 2018 13:32:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uLuImVj5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935945AbeFNUbc (ORCPT + 99 others); Thu, 14 Jun 2018 16:31:32 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:41371 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755424AbeFNUba (ORCPT ); Thu, 14 Jun 2018 16:31:30 -0400 Received: by mail-wr0-f196.google.com with SMTP id h10-v6so7727148wrq.8; Thu, 14 Jun 2018 13:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cWhwXgX0H/4LBeqGgsmdRAVmtYeX6gotDwpvdxcDw0c=; b=uLuImVj58ES72/I0qxuh3e3CeS5uGK67/TGon2gTqQMTXgbDuiG0eRXabzf+ymE/WZ RjldI94R3Dr8Az13zaJLxCbrrvkb5N+VTFdb59/3ioVS1Nnvgt4wSt8pSUCgQXoulvzb 2DkMAwB3V6dgPT6Erheboiu6HZa7p69FDTRJWM9Uo9tlNe8M8lrkMeQiZRyrQiWzx9cW eD+xmjyXvhAZBS4IrM/dZT3BnC6BB10q4nSTCwu3NgQdWX4G97FvihUW32e11zE4igqV lwW2Bjc6M++Xy97KyVX+tKK/S6Zc/Gx5EEkKA9cEcaPZgfc4kH5LsT14XVq9T7unuCrZ tfHQ== 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=cWhwXgX0H/4LBeqGgsmdRAVmtYeX6gotDwpvdxcDw0c=; b=WZuthBb/m8OukYhTDRxhcvON1fMdTzPQf8uXD/4bH9b8rJvAwnxIOTjADOLKofytxT Mf/MVQXZZm/y0q5cYKL6paPgMiSwsrkjR36OhPo1Gqx/8h2I8WZK3WBl6GlurJEsrwyk eRW8QUuCxhbEpY7dZ/q+KPTtJHYzDr+OIYcftUy9w8pgwyJVkr7oGUxPWL0DAFoSaJtc Wp6gDpf3ng+FVBaN3L/q+HSvW8MG+JWoT26evSXA3jLgE0yQSfubvK3DL6hnUOvHF/YJ 0ouQUjP31SOhP8HjUkSZIBfT/rtqWsuFhX4gHHevlgc8VRpBqX0HU8U1DA3eElOLSDkb Dm6A== X-Gm-Message-State: APt69E3iLzta/8psRsUpkD2mivgQvWnz/3YTBdSnIEyRowN+W/K9ax8+ XKPxs7aAjRJ2Gd0q02nI76I= X-Received: by 2002:adf:de08:: with SMTP id b8-v6mr3547219wrm.39.1529008288734; Thu, 14 Jun 2018 13:31:28 -0700 (PDT) Received: from gcc67.tetaneutral.net (gcc67.tetaneutral.net. [2a03:7220:8080:c00::1]) by smtp.gmail.com with ESMTPSA id w126-v6sm28584wmw.29.2018.06.14.13.31.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 13:31:27 -0700 (PDT) From: ilia.lin@gmail.com To: Ilia Lin , Ilia Lin , "Rafael J . Wysocki" , Viresh Kumar Cc: Dan Carpenter , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: kryo: Fix possible error code dereference Date: Thu, 14 Jun 2018 22:29:21 +0200 Message-Id: <20180614202921.32535-1-ilia.lin@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilia Lin In event of error returned by the nvmem_cell_read() non-pointer value may be dereferenced. Fix this with error handling. Signed-off-by: Ilia Lin --- drivers/cpufreq/qcom-cpufreq-kryo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/qcom-cpufreq-kryo.c b/drivers/cpufreq/qcom-cpufreq-kryo.c index d049fe4b80c4..5e9511223ce9 100644 --- a/drivers/cpufreq/qcom-cpufreq-kryo.c +++ b/drivers/cpufreq/qcom-cpufreq-kryo.c @@ -115,6 +115,8 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) speedbin = nvmem_cell_read(speedbin_nvmem, &len); nvmem_cell_put(speedbin_nvmem); + if (IS_ERR(speedbin)) + return PTR_ERR(speedbin); switch (msm8996_version) { case MSM8996_V3: -- 2.11.0