Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp986618ybp; Fri, 11 Oct 2019 07:25:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFlSlQY7uCT0UkiVswhRKFaCUdxLQHHRAaVlkFPtiAiWWw/p2+yfQkB1aY1vQ1zUnwMUlG X-Received: by 2002:a17:906:4716:: with SMTP id y22mr14205457ejq.225.1570803927851; Fri, 11 Oct 2019 07:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570803927; cv=none; d=google.com; s=arc-20160816; b=lEd+ik3oLSUeu/hTNrVlM5RivLEwW7hPE03XsJg/VMhA4TYTf5zVpSGpOeJxZD/5Gb yJhpzF3i08psSV+3ZQWS9fSPdrQhsS7FkjEjX+kZsvT41GTxQcwLDTibBx7Dbws4yPRH /GSY7Jnu7eQuJAjZ3pt2k0YBx8iKRtwsoANz2S4B2uQC3eNiVVsdW80EmjrpDXi/Njdd 0lQcI0wGhfS+nMAMhD3ldzlsMXsrd4/Sy3x8a+vRxhSH5DcpzIsN/fMrIsb37VOHjQ6q aLk3i3eVZZ+EIv6AvplsyM6r4lChfLJSHVd8eHfPiWfFieifKBaZVH9HbywjrsGwonlY VvXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NmERbDUzYksBa6VYuAY7QcCVuRz4V6PIrNu5K5Hu0/0=; b=idUujoyJqTJPQ75rcidNjpXC/w5i39GgD0tXiNG4qBvDGhi/Qv7lpBEL5EN+8sjOMU xdYULWPCGj69eoSGnRK1PRwgoXSnIChOgMijTRjJqGXYO7PrKnAngpdDf7kGFnqUcl1N msLu/Wbx+YDvff91JSvAtMoLWK64xmX+9yRjB8JeuzweYFNhIF765iVSbKnPb98w8JvO 9xT6dcoBFfhucMPvF7AhiAhtlkY9rGpFrFF8lm6hOqPuxeU+QtPxg3tzfuSHasgZI7Bd 7OqmgxseyMKbpNrBM1FIM7mV2PNgXhneA2QO1Wfr+yVdxTwOzmAsG/dp32IvHPiMupMu GZhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uiM7sMCF; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si5299302ejp.397.2019.10.11.07.25.04; Fri, 11 Oct 2019 07:25:27 -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=@kernel.org header.s=default header.b=uiM7sMCF; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728235AbfJKOYd (ORCPT + 99 others); Fri, 11 Oct 2019 10:24:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:36378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728068AbfJKOYd (ORCPT ); Fri, 11 Oct 2019 10:24:33 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97B4F206A1; Fri, 11 Oct 2019 14:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570803872; bh=QAb4bxoTz2iQy8IO0iLYwBX2ij2Bqz40OXibaGp0LAE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uiM7sMCFSjxUZ8NgAbCBCUdtgurhfH0Ka5EmsYcs/zeD7OGnInylw6oUN60nffJ1n 0FqG46kIjiBOagecYOUMvejBlvompnZuw6xAu4X+92OWzdCnyhWPNa29+nFj5+MbeD 2AaDOlzJArudhaSe7jQZKduYIke8HXwRBQrp4ET8= Date: Fri, 11 Oct 2019 15:24:27 +0100 From: Will Deacon To: Matthias Maennich Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Jessica Yu , Masahiro Yamada , Martijn Coenen , Lucas De Marchi , Shaun Ruffell , Greg Kroah-Hartman , linux-kbuild@vger.kernel.org, linux-modules@vger.kernel.org Subject: Re: [PATCH 1/4] modpost: delegate updating namespaces to separate function Message-ID: <20191011142426.vwfhw4dtyy4nfzkv@willie-the-truck> References: <20191010151443.7399-1-maennich@google.com> <20191010151443.7399-2-maennich@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191010151443.7399-2-maennich@google.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 10, 2019 at 04:14:40PM +0100, Matthias Maennich wrote: > Let the function 'sym_update_namespace' take care of updating the > namespace for a symbol. While this currently only replaces one single > location where namespaces are updated, in a following patch, this > function will get more call sites. > > The function signature is intentionally close to sym_update_crc and > taking the name by char* seems like unnecessary work as the symbol has > to be looked up again. In a later patch of this series, this concern > will be addressed. > > This function ensures that symbol::namespace is either NULL or has a > valid non-empty value. Previously, the empty string was considered 'no > namespace' as well and this lead to confusion. > > Signed-off-by: Matthias Maennich > --- > scripts/mod/modpost.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 4d2cdb4d71e3..9f5dcdff4d2f 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -362,6 +362,22 @@ static char *sym_extract_namespace(const char **symname) > return namespace; > } > > +static void sym_update_namespace(const char *symname, const char *namespace) > +{ > + struct symbol *s = find_symbol(symname); > + /* That symbol should have been created earlier and thus this is > + * actually an assertion. */ > + if (!s) { > + merror("Could not update namespace(%s) for symbol %s\n", > + namespace, symname); > + return; > + } > + > + free(s->namespace); > + s->namespace = > + namespace && namespace[0] ? NOFAIL(strdup(namespace)) : NULL; > +} You made me look up C operator precedence again, but it's fine so: Acked-by: Will Deacon Will