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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71797C00528 for ; Mon, 31 Jul 2023 11:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232416AbjGaLU6 (ORCPT ); Mon, 31 Jul 2023 07:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232244AbjGaLUy (ORCPT ); Mon, 31 Jul 2023 07:20:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B21E810F4 for ; Mon, 31 Jul 2023 04:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690802403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=V5VMLpHOhxXlUy0bWDF9kXZ97zc/VghMcLBrU5Ym92c=; b=KNr1ZOZt8BHe9a9IfvWLmd6idJQ1b5fadL7pqUG5MP2af2rlu5ZkO/Efin4UqQiG+czwot TfWvrchXUOMxxLvAdWRGI3ar3Qch6z1eu3ILZ/x2sQmkBQ/wiYZsUW49zFYQCS1cnh2gW6 p07/AuHmHRN8lC2ysCU1WQMuC8PwWBo= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-g3EhWb3iOUGdgYFpGH6GRA-1; Mon, 31 Jul 2023 07:20:02 -0400 X-MC-Unique: g3EhWb3iOUGdgYFpGH6GRA-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-40eedfd4119so12476901cf.1 for ; Mon, 31 Jul 2023 04:20:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690802402; x=1691407202; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=V5VMLpHOhxXlUy0bWDF9kXZ97zc/VghMcLBrU5Ym92c=; b=Xgwt+ApdOJaPPr0ONHPJAVPJijOhq9Wjg5/h8BMx73QymOwK9YTgBLOOIjYaFM023b z8Nqb9jvs9BeYlF5CD3eMBMxYM/fxGLiw1bhxt3+23/5xEuNzR7nJjmz6/VkXWoVXdF7 uALo2mpF5ycjuLGrtPRGFbowhjTE59Oie8VlewMXelLQMHBgOq3fFAqfuo2IkowO5t5U /P6Sh6OZzdvmFj5WbbDxziqP0v561pgZcwct1rjPsIhlzeucYR7LZpWHOoAv+8BuWeu8 J2TUw+orQLJfTfdKoQAZu9+ygwXJsShHtnlForCpvVXd/TPnxGaZ4+x++gvI3jQqeKBn Pf5w== X-Gm-Message-State: ABy/qLZM4z2eCuC9Gf7kSzGfplsScaQaVK/179wM1cAYa18pjzz7NvKx 3gebXTFKN6389Aci5e7ZP/RnQFdAMIt1KNukddrteL1pQqm9Cy8EGF4BZMQgGOmclJR952pRSSh KS9SNIFvEYL9sXoDNx5Ce2y63k/fbM95p X-Received: by 2002:ac8:7f08:0:b0:409:f273:e28d with SMTP id f8-20020ac87f08000000b00409f273e28dmr8487951qtk.62.1690802402018; Mon, 31 Jul 2023 04:20:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEVg6/rKm0s9MUEi0BGjFI/ks14KzdgpHID8GGIpvi7qxLN20fQB6V4fe5ZTG4d6GXjiIiI+g== X-Received: by 2002:ac8:7f08:0:b0:409:f273:e28d with SMTP id f8-20020ac87f08000000b00409f273e28dmr8487873qtk.62.1690802401624; Mon, 31 Jul 2023 04:20:01 -0700 (PDT) Received: from vschneid.remote.csb ([149.12.7.81]) by smtp.gmail.com with ESMTPSA id x7-20020ac80187000000b00403f5873f5esm3447309qtf.24.2023.07.31.04.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 04:20:01 -0700 (PDT) From: Valentin Schneider To: Steven Rostedt , Josh Poimboeuf Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, rcu@vger.kernel.org, linux-kselftest@vger.kernel.org, Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Peter Zijlstra , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Jason Baron , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Yair Podemsky Subject: Re: [RFC PATCH v2 02/20] tracing/filters: Enable filtering a cpumask field by another cpumask In-Reply-To: <20230729150901.25b9ae0c@rorschach.local.home> References: <20230720163056.2564824-1-vschneid@redhat.com> <20230720163056.2564824-3-vschneid@redhat.com> <20230726194148.4jhyqqbtn3qqqqsq@treble> <20230729150901.25b9ae0c@rorschach.local.home> Date: Mon, 31 Jul 2023 12:19:51 +0100 Message-ID: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org On 29/07/23 15:09, Steven Rostedt wrote: > On Wed, 26 Jul 2023 12:41:48 -0700 > Josh Poimboeuf wrote: > >> On Thu, Jul 20, 2023 at 05:30:38PM +0100, Valentin Schneider wrote: >> > int filter_assign_type(const char *type) >> > { >> > - if (strstr(type, "__data_loc") && strstr(type, "char")) >> > - return FILTER_DYN_STRING; >> > + if (strstr(type, "__data_loc")) { >> > + if (strstr(type, "char")) >> > + return FILTER_DYN_STRING; >> > + if (strstr(type, "cpumask_t")) >> > + return FILTER_CPUMASK; >> > + } >> >> The closing bracket has the wrong indentation. >> >> > + /* Copy the cpulist between { and } */ >> > + tmp = kmalloc((i - maskstart) + 1, GFP_KERNEL); >> > + strscpy(tmp, str + maskstart, (i - maskstart) + 1); >> >> Need to check kmalloc() failure? And also free tmp? > > I came to state the same thing. > > Also, when you do an empty for loop: > > for (; str[i] && str[i] != '}'; i++); > > Always put the semicolon on the next line, otherwise it is really easy > to think that the next line is part of the for loop. That is, instead > of the above, do: > > for (; str[i] && str[i] != '}'; i++) > ; > Interestingly I don't think I've ever encountered that variant, usually having an empty line (which this lacks) and the indentation level is enough to identify these - regardless, I'll change it. > > -- Steve > > >> >> > + >> > + pred->mask = kzalloc(cpumask_size(), GFP_KERNEL); >> > + if (!pred->mask) >> > + goto err_mem; >> > + >> > + /* Now parse it */ >> > + if (cpulist_parse(tmp, pred->mask)) { >> > + parse_error(pe, FILT_ERR_INVALID_CPULIST, pos + i); >> > + goto err_free; >> > + } >> > + >> > + /* Move along */ >> > + i++; >> > + if (field->filter_type == FILTER_CPUMASK) >> > + pred->fn_num = FILTER_PRED_FN_CPUMASK; >> > + >>