From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48AF6CA9EAE for ; Tue, 29 Oct 2019 16:00:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B91120856 for ; Tue, 29 Oct 2019 16:00:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VlJn9P93" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390128AbfJ2QAG (ORCPT ); Tue, 29 Oct 2019 12:00:06 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:39497 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390120AbfJ2QAG (ORCPT ); Tue, 29 Oct 2019 12:00:06 -0400 Received: by mail-vs1-f68.google.com with SMTP id y129so9075595vsc.6 for ; Tue, 29 Oct 2019 09:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i7RbkqGbh9IA/JEvFLfGYQjmnKeTMtOGBd0rCBDW1LI=; b=VlJn9P93/+GJXnkI0YVl81cXWpN32BsLjxckAajcWxT2TzFp3+3EMPKRP+K+gqZKoi roFJ1OJgiYq2YK7ni/d1O9EDBeZlwfaRNyF3P9r3nFZALA4mBXqKksZ97mK/8YcIbC1X rMCGbjnc4FgPOTC/m3YgQ9jpZeQWGyAa5ZXGw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i7RbkqGbh9IA/JEvFLfGYQjmnKeTMtOGBd0rCBDW1LI=; b=AI4RjlVIhh8m7jzhg4qeHFlpbsHvZ0Lgh/ShQYW4JfCrbllyFCjelrm87n5UI9BaJR I6Yadxem7ud84oG+WS128tyc7AonBCBYDNVXOXNze7mdn+803K63+L3PP1T6XBUlXKnV 0V1d0Q16C/58CMCVpBlYFR6mUJnLw+HqGXtSJ/Dc77psgkCcz11IY18lSZNb8Juepr9S TpLtYc+/UPiqPhkQcZrrUdKaHaPut0I+9TvcHY37/ExeYaQMgMiyGUBojApguglWWBZg Ebsd9zN2iQEpZR1B6EKUTy25W8CUwrsO9u8s49V7ljGGNjQ4JnWokMSCp0pZsQknxS5x +A7g== X-Gm-Message-State: APjAAAU7TV8P7TgwzZ4o7n9JHSOJaHqFIO5/hTUJ3I97JYv6QTQNtTdh PRKAyUadwhJNdxJMMAxOsKkQlYsuvI0= X-Google-Smtp-Source: APXvYqy+ZyG+eM1xZFQmhvyfL7HmF+rdw89DLCZH/pduuyGjl9pT4iU7ld/YZzHcMaiJJFsmxjSYRQ== X-Received: by 2002:a67:2745:: with SMTP id n66mr2314558vsn.32.1572364803420; Tue, 29 Oct 2019 09:00:03 -0700 (PDT) Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com. [209.85.217.41]) by smtp.gmail.com with ESMTPSA id i7sm4998630vsp.1.2019.10.29.09.00.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Oct 2019 09:00:02 -0700 (PDT) Received: by mail-vs1-f41.google.com with SMTP id k15so9093879vsp.2 for ; Tue, 29 Oct 2019 09:00:02 -0700 (PDT) X-Received: by 2002:a67:2c91:: with SMTP id s139mr2171081vss.26.1572364801490; Tue, 29 Oct 2019 09:00:01 -0700 (PDT) MIME-Version: 1.0 References: <201910281603.E90E9627A@keescook> <0451f7e8-ff96-f411-ed26-1310999be3c5@embeddedor.com> In-Reply-To: <0451f7e8-ff96-f411-ed26-1310999be3c5@embeddedor.com> From: Kees Cook Date: Tue, 29 Oct 2019 08:59:47 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Coverity: calibrate_8976(): Memory - illegal accesses To: "Gustavo A. R. Silva" , Colin King Cc: coverity-bot , AngeloGioacchino Del Regno , Amit Kucheria , Daniel Lezcano , Linux-Next Content-Type: text/plain; charset="UTF-8" Sender: linux-next-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-next@vger.kernel.org On Mon, Oct 28, 2019 at 5:08 PM Gustavo A. R. Silva wrote: > > Hi, > > This one has been addressed already: > > https://lore.kernel.org/lkml/CAK7fi1a8CiX=HVqhZSmQJdcjF1X_kdHFDwJhEpYJUcdPTcbMQA@mail.gmail.com/ > Ah-ha, excellent. Colin, do you want me to CC you on these automatic reports too? -Kees > Thanks > -- > Gustavo > > On 10/28/19 18:03, coverity-bot wrote: > > Hello! > > > > This is an experimental automated report about issues detected by Coverity > > from a scan of next-20191025 as part of the linux-next weekly scan project: > > https://scan.coverity.com/projects/linux-next-weekly-scan > > > > You're getting this email because you were associated with the identified > > lines of code (noted below) that were touched by recent commits: > > > > 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976") > > > > Coverity reported the following: > > > > *** CID 1487355: Memory - illegal accesses (USE_AFTER_FREE) > > /drivers/thermal/qcom/tsens-v1.c: 245 in calibrate_8976() > > 239 int mode = 0, tmp = 0; > > 240 u32 *qfprom_cdata; > > 241 > > 242 qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib"); > > 243 if (IS_ERR(qfprom_cdata)) { > > 244 kfree(qfprom_cdata); > > vvv CID 1487355: Memory - illegal accesses (USE_AFTER_FREE) > > vvv Passing freed pointer "qfprom_cdata" as an argument to "PTR_ERR". > > 245 return PTR_ERR(qfprom_cdata); > > 246 } > > 247 > > 248 mode = (qfprom_cdata[4] & MSM8976_CAL_SEL_MASK); > > 249 dev_dbg(priv->dev, "calibration mode is %d\n", mode); > > 250 > > > > If this is a false positive, please let us know so we can mark it as > > such, or teach the Coverity rules to be smarter. If not, please make > > sure fixes get into linux-next. :) For patches fixing this, please > > include: > > > > Reported-by: coverity-bot > > Addresses-Coverity-ID: 1487355 ("Memory - illegal accesses") > > Fixes: 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976") > > > > > > Thanks for your attention! > > -- Kees Cook