Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp730409imm; Fri, 3 Aug 2018 10:30:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfUOT04Xrj78D7GTHZCJvaMoGQWsLa8Or3o7f6tSP5hXAhR0Z/4uBIGw+9C7SbmKXIAhA8L X-Received: by 2002:a62:9992:: with SMTP id t18-v6mr5559658pfk.239.1533317433143; Fri, 03 Aug 2018 10:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533317433; cv=none; d=google.com; s=arc-20160816; b=FjDxANs5QUaqvEcm/DFZlhd8cyHLaIGQME61GLZ3B5AvX6xNScgI4hTTFlCKZzen2f icK3yiApszoOX5ayfj1b5MqYheW3ITVt2sBUN/n0CaneliKyUbk4wkRkJSBFMfy/NTL3 +dqW40u1yLW8AlxhE3GFPoMkbMFLKsp+GiYgN8MP7QzmpUO23mvYuXL52E4WwCUTUvgK T9fqKknNkgeOTdPPNM2+P7HbmtnprfVJqG+MRqVEkVyUoqEwHpk6YHN/6JERHPVv1UEa LqorOyZnagitPCrR4BNtYMAczo/FtuxAuS9Jbz16WbjElsM2oE6ewTozsvO1Ndsg9NrA cJPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=UOKJgVih0koMFH6oX0QAv0yRK8fzk+A+EknAHULkhhA=; b=J7lnHcNtayUh/0O+9wOpue9bUU70htWJEUg/8zInGjy3SGl76C6fZn1w60p0YErceJ jN9axG/oW/hNwAaf/Z0PirvFl2bmlNpspr5Za1ritdsuQOwo3VCseYlLWZ+V5eKfa8OX 2SLtOa1TT3ACBcu2eYRrBEoG9YzkPScOAjrgT/GsggltvW1ESyva9ihQX8I5Fzc/gj6C t4fiy+PA7CJSuvl+i/EaLmKjS7HAy4Br57aF/6BDTHcsZRTHRfK/n2rd2KPezDCs1Kqb CBsMUkXNsc8/31d2ia/wJ9WJlQN5j0R91J8ZPgvzg0pp0okYIgYsXrAMsfWXvT+3e7k5 UFug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bqYNup+z; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 140-v6si5750322pgd.19.2018.08.03.10.30.18; Fri, 03 Aug 2018 10:30: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=@linaro.org header.s=google header.b=bqYNup+z; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729881AbeHCT0i (ORCPT + 99 others); Fri, 3 Aug 2018 15:26:38 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:50928 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729639AbeHCT0i (ORCPT ); Fri, 3 Aug 2018 15:26:38 -0400 Received: by mail-it0-f66.google.com with SMTP id j81-v6so7559227ite.0 for ; Fri, 03 Aug 2018 10:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UOKJgVih0koMFH6oX0QAv0yRK8fzk+A+EknAHULkhhA=; b=bqYNup+zXZy6YMshij4Es6VXPhAbZEasTN4ff54aAi0hSmmtj0JlY6L9UUSELrWYFD 42s4N46P4MjY8QO6d/98ziUFXv3TB8lbLyoxyo2U9hLN6Xmv4ixJ0L9cM4go0AdRahAF ovtVreagiiKZDSBILKdOSysAetLAcLe7PTWT8= 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=UOKJgVih0koMFH6oX0QAv0yRK8fzk+A+EknAHULkhhA=; b=jLkThCUa7rGdi7B4b807+eyyt/ofG+ghZ9fMAv544YBH0ADk+WKtYFXdbtH3/qaS3E amWXMD20WrXspdMbGRmSDPLMtQ2I0+la+zX8AuIoMaIXp2ZfdJEZBDLOnJOPqxVzHdIa ZUcbr5zeDsg9Q9DMiosojRWH4aMoknC16i4gaIXU4AJegdtxv519DTcZH4uqDcq2r4qV mPpCa7jvUOZZHUbbRGr7aFAyFAN6FcEG3sdcb3wIc4rzZVj/7oXKxFt9pyFHumFQ3u+l 5y0hl4s38v1sGBxYzwXGNPyUJFWkNlqMzSDg2rsWh6QQJ7/IN6gcmRjmXPcj65x/H2yK Zelw== X-Gm-Message-State: AOUpUlHRbePUKrds2pRz49F6gdHr/tC48SBlLL96bSfLvdSFc36hEvpU cSPTbUj9TFj/iVfX3QAvuf0dBiFaiUU41gqU14Dl4A== X-Received: by 2002:a24:5004:: with SMTP id m4-v6mr7025038itb.38.1533317363364; Fri, 03 Aug 2018 10:29:23 -0700 (PDT) MIME-Version: 1.0 References: <20180801051049.21360-1-yuehaibing@huawei.com> In-Reply-To: <20180801051049.21360-1-yuehaibing@huawei.com> From: Linus Walleij Date: Fri, 3 Aug 2018 19:29:11 +0200 Message-ID: Subject: Re: [PATCH v3] pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state To: yuehaibing@huawei.com Cc: Masahiro Yamada , Kees Cook , Jisheng Zhang , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 1, 2018 at 7:11 AM YueHaibing wrote: > fixes following Smatch static check warning: > > drivers/pinctrl/berlin/berlin.c:237 berlin_pinctrl_build_state() > warn: passing devm_ allocated variable to kfree. 'pctrl->functions' > > As we will be calling krealloc() on pointer 'pctrl->functions', which means > kfree() will be called in there, devm_kzalloc() shouldn't be used with > the allocation in the first place. Fix the warning by calling kcalloc() > and managing the free procedure in error path on our own. > > Fixes: 3de68d331c24 ("pinctrl: berlin: add the core pinctrl driver for Marvell Berlin SoCs") > Signed-off-by: YueHaibing > --- > v2: free pctrl->functions instead of function as Jisheng Zhang suggested > v3: v2 I send a wrong patch,this is the correct patch. Patch applied with Jisheng's ACK! Yours, Linus Walleij