Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2524157imm; Thu, 7 Jun 2018 12:06:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI/ffLGjrbU0JBWWSvRWYIicnVaWZqve0MehPQreBfrrDT+Ap2q6s8pZYAxPQOo7bnVQd7Q X-Received: by 2002:a62:bca:: with SMTP id 71-v6mr2834670pfl.234.1528398373412; Thu, 07 Jun 2018 12:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398373; cv=none; d=google.com; s=arc-20160816; b=y/j7F39IMfKL3V64mvwiiOjHOdruGhRoMZC+ICKb6APayF0mTSFTxUSQmWWdbUU/Uo VTkXHDSD0QhDKGwMmUh1F2CqvCTIBnmE2zPRjx7o33pgZ4nJKEd3GcrF50ZiGV3lQ7lU 7kAknFJWrpmvtOlGrw50Coa5f+nQO4CsV3zh9pCknaNzKwhZyICyTXuH46UXbH0vCdvy dpZ33V8HQ/YVEd8wnYRB5ClJAUWKH4fP7eyJ/hysC4NFXDrVChgU46BLwnS9C2hiwzrS OBKHHomhkpc4peiCDMFI6CewlEWxtRt3mbd3uSehZTle6TV1/5MPr6WTPJwIUrYJGsD9 5n0Q== 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=IRDXR3/xr8ArrjhF9/uiOCf2az0ATHcm6kczPGcdUGA=; b=a6Annm10z8e7UJy/eIZ5S4EjoBZR3f8Rt0f2wXymZC3JgXwpKAdDB1xTYI9fyF0Nrk CBb7aVzhz9o9FOIVZZeBDbMiHIilU8/tIb9m6SHlT/4mwGT5kd7UPhOReHNKodxqPWnY yTykqMmeFKu1h0dGovJdVstg4+ncHZ/TrblL+vYofPc/m8Do2mINz6BmLYYL1gmF/qG3 yX0tX5NW3D18NiwWKCiooVZjNMlo6C3KAl3a1DHFFe+sEYK0AS+ygW8kvA0d/bQtwNez cHOqs3i4V78ZKFBH1xyPdaEsPMmEiL/KVJGxBxJUXGS0dVP2yX3zjy3XGq+vS6+ndzU6 wMKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Vayt2k48; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64-v6si55689539pla.530.2018.06.07.12.05.59; Thu, 07 Jun 2018 12:06:13 -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=@google.com header.s=20161025 header.b=Vayt2k48; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934258AbeFGRe4 (ORCPT + 99 others); Thu, 7 Jun 2018 13:34:56 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:43348 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933021AbeFGRez (ORCPT ); Thu, 7 Jun 2018 13:34:55 -0400 Received: by mail-wr0-f193.google.com with SMTP id d2-v6so10673632wrm.10 for ; Thu, 07 Jun 2018 10:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IRDXR3/xr8ArrjhF9/uiOCf2az0ATHcm6kczPGcdUGA=; b=Vayt2k48hBHGL48NfP/AOlllX1B1FyfML/m2ova7WaSjBFgOzhPdOUJPLMZMXGPKJs g7Cvb3toDdJhoJIbgmnshqNt+SAtr9SMLudTv0h7C0J8z3ENfON/4PRanSPaCxlhQ0+i 5lyORb8Lobp7YFUgvlCV8DkjM7L0/RFoP7yHP5PMCSTIMChtDGe949wKAqE0rlJ5XHO3 LuvHB+8F7tR2kwwXh79LBqUBNLQFbpOOGzFDQuZ9/FcyW36hxaSOOGSQz84whUDEZCPe EV0HBl2x/nzwVjykdmQKS+lIJyrvQ9c7asHvwuUR0va3odqpDRV3fAYcAvqqFtY15A8q XArg== 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=IRDXR3/xr8ArrjhF9/uiOCf2az0ATHcm6kczPGcdUGA=; b=U5++NoiLHh5RYX2BgI7FUYV+vspsaiKeQacZg6XEvqkZepAOiBetEioMIWroiSqYXj waP3UhvK7Hrtxn6OQyxyep6XbzP1Z5spWEwAmpAep0JVxRlNv9ud2y9jpvI5AEUGXfeP mCCcpN1reIv2+JzOjFeLAjOJEgNW4i+luGP8diiZ833oJWFHuiaL3/cz7rdYzL1a7XW9 LFz9qWor8nT80l9d6BmxnRaItC0eVwlN00w7VF4DAqq3FtQpdn+m2HXyfUQ7xRsec0bU zENqJ3eD8k66L5g0pG4RkGFswgWTylJfDZuoVWiSSVSj0KoBYGBtucXlfyiv7TX7Y7oC LAcQ== X-Gm-Message-State: APt69E3KK6xT7QtIm6ELfkaJ6EZT7DlVC1cJJHf0JsSwdxXPVtMTaA/+ KIVDW2sZBDwOa+Vtl2UvnhVlQ59QiD1/4W2BwmXh2w== X-Received: by 2002:adf:dd03:: with SMTP id a3-v6mr2626000wrm.2.1528392893664; Thu, 07 Jun 2018 10:34:53 -0700 (PDT) MIME-Version: 1.0 References: <20180607145720.22590-1-willy@infradead.org> <20180607145720.22590-7-willy@infradead.org> <03d9addb-9c68-c6e5-d7db-57468fc3950c@nvidia.com> In-Reply-To: <03d9addb-9c68-c6e5-d7db-57468fc3950c@nvidia.com> From: Shakeel Butt Date: Thu, 7 Jun 2018 10:34:41 -0700 Message-ID: Subject: Re: [PATCH 6/6] Convert intel uncore to struct_size To: rcampbell@nvidia.com Cc: Matthew Wilcox , keescook@chromium.org, Matthew Wilcox , Linux MM , LKML , kernel-hardening@lists.openwall.com 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 Thu, Jun 7, 2018 at 10:30 AM Ralph Campbell wrote: > > > > On 06/07/2018 07:57 AM, Matthew Wilcox wrote: > > From: Matthew Wilcox > > > > Need to do a bit of rearranging to make this work. > > > > Signed-off-by: Matthew Wilcox > > --- > > arch/x86/events/intel/uncore.c | 19 ++++++++++--------- > > 1 file changed, 10 insertions(+), 9 deletions(-) > > > > diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c > > index 15b07379e72d..e15cfad4f89b 100644 > > --- a/arch/x86/events/intel/uncore.c > > +++ b/arch/x86/events/intel/uncore.c > > @@ -865,8 +865,6 @@ static void uncore_types_exit(struct intel_uncore_type **types) > > static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) > > { > > struct intel_uncore_pmu *pmus; > > - struct attribute_group *attr_group; > > - struct attribute **attrs; > > size_t size; > > int i, j; > > > > @@ -891,21 +889,24 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) > > 0, type->num_counters, 0, 0); > > > > if (type->event_descs) { > > + struct { > > + struct attribute_group group; > > + struct attribute *attrs[]; > > + } *attr_group; > > for (i = 0; type->event_descs[i].attr.attr.name; i++); > > What does this for loop do? > Looks like nothing given the semicolon at the end. > Finding the first index 'i' where type->event_descs[i].attr.attr.name is NULL with the assumption that one such entry definitely exists.