Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2482985pxk; Sun, 20 Sep 2020 05:51:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/uu9o0kSwtGC3jy9MQmrEJF/E2FsNkOyoNoef5pbvnyNpsTYrGfx74b+XVuWoirqtwNc+ X-Received: by 2002:a17:906:3ad0:: with SMTP id z16mr46829949ejd.193.1600606284014; Sun, 20 Sep 2020 05:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600606284; cv=none; d=google.com; s=arc-20160816; b=X6zF0qbubfU1EEWEt912mb9CjYpWliQGvUH+RCAgb0dwh3g93ShSd1FeXlQy77Wa+t Tz5JPQ3uxcnZBNjEoarSWtdE+5YZSaBUitc2pLsZcop0DX2+xG6nHtYYosUBiA4mpQMa TYvolw6Xd1YEB64Tl/L33qnoxmzHFwLqDiC4v3QYdnZRtZ4CPgaAXKfXHD60/auEYhIM CWzfzAC0Qnie2yeNzkYYzjBcFlmULTHbvs1OdjQn+oo/gWAvf5JShCeIW1BP/lkqy0rn J7IxVVW1P9stNnsvd8ElmFsJoHaS9TcmysQJOuNJN0bRkwXFn7hN/lp1Xdcay9h5LgIQ 0NEg== 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:references:message-id :in-reply-to:subject:cc:to:from:date; bh=QMeLwwkm4yjCj4CbFqUoKPwXUM9tNTxQAKgL+knORtk=; b=NN3jMZAeUUFdo8WJODULOmD8Ct7rUfnw4RmkubH8Wu3CfYUiLrAeJgAlssWa5yFVSZ BkAQbPAEbmcwQV2lDD4Qr6qw+jbu4KPQqtcMtXan3idE2u+ZO3fOFldiMzeHiH4eSslx qxCCZXqmohM5KsfzJ/5Es3KojRxUW4m1n3p40SZO0oKZX9S0V/4uVS0NAxKMgwkem0zv 5lCVHxYGqXcKzv0fzxZpyeMmEuswwe3xJGOcKILPIinicMGOEfj3RbyEzgX+BMMhCYmP Hmkha/ZHeAhBgI4ykYc3nFm6EMkdXo908UYQJT2gcWpN7B90wFJehM077J29INRDupVc 8tFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q6si6249985edw.446.2020.09.20.05.50.58; Sun, 20 Sep 2020 05:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726369AbgITMrN (ORCPT + 99 others); Sun, 20 Sep 2020 08:47:13 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:21468 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbgITMrM (ORCPT ); Sun, 20 Sep 2020 08:47:12 -0400 X-IronPort-AV: E=Sophos;i="5.77,282,1596492000"; d="scan'208";a="468614397" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2020 14:47:11 +0200 Date: Sun, 20 Sep 2020 14:47:11 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Greg Kroah-Hartman cc: kernel-janitors@vger.kernel.org, Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/14] pch_uart: drop double zeroing In-Reply-To: <20200920121404.GA2830482@kroah.com> Message-ID: References: <1600601186-7420-1-git-send-email-Julia.Lawall@inria.fr> <1600601186-7420-2-git-send-email-Julia.Lawall@inria.fr> <20200920121404.GA2830482@kroah.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 20 Sep 2020, Greg Kroah-Hartman wrote: > On Sun, Sep 20, 2020 at 01:26:13PM +0200, Julia Lawall wrote: > > sg_init_table zeroes its first argument, so the allocation of that argument > > doesn't have to. > > > > the semantic patch that makes this change is as follows: > > (http://coccinelle.lip6.fr/) > > > > // > > @@ > > expression x,n,flags; > > @@ > > > > x = > > - kcalloc > > + kmalloc_array > > (n,sizeof(struct scatterlist),flags) > > ... > > sg_init_table(x,n) > > // > > > > Signed-off-by: Julia Lawall > > It inits the first entry in the array, but what about all of the other > ones? Is that "safe" to have uninitialized data in them like your > change causes to happen? Sorry, I don't follow. The complete code is: priv->sg_tx_p = kcalloc(num, sizeof(struct scatterlist), GFP_ATOMIC); if (!priv->sg_tx_p) { dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__); return 0; } sg_init_table(priv->sg_tx_p, num); /* Initialize SG table */ and the definition of sg_init_table is: void sg_init_table(struct scatterlist *sgl, unsigned int nents) { memset(sgl, 0, sizeof(*sgl) * nents); sg_init_marker(sgl, nents); } It looks to me like it zeroes all of the elements? The same file does contain a call: sg_init_table(&priv->sg_rx, 1); But that's not the one associated with the patch. julia