Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2727392rwb; Sat, 29 Jul 2023 12:36:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlFYukDW6AmNMJclqVq1ciUTzM/uczosSF0zbIaN0zhTjd3Zq+yI+nd2Q5yph0xCfFneybDf X-Received: by 2002:a05:6402:10c1:b0:51d:e2c4:f94a with SMTP id p1-20020a05640210c100b0051de2c4f94amr4116062edu.20.1690659418055; Sat, 29 Jul 2023 12:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690659418; cv=none; d=google.com; s=arc-20160816; b=hFqgkokTOH+ctj2uZALKAPZihUp4XzxQgBJ6mPyIugV0GTWcwdLMUMqSS3xwji1u5v AD8lLgky0huVABTwKbBaIs01xS3NthLLzkWfa8iLT0p6nVX/PctotK838T4DVEP1mdbi iurfPmuQ49bpQYK92P1sHkaZsgj8/fVm7G8O5VMSCIPEZSY4gaQNh+6qf12evI3eBEyN e3n5nG8QuyhpVCTPb8nAoZeuK6gOrxLL80imFiqzkIP3oCPkGeIZSiUzgVfGB1aeUAJf vu8opDnaD5LPwG7P5ii1ICGLWn4HVvtkq9k8MHBx49o4yd0MyD7ii8+SByCjQjhppK+P WwZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=t6SUyxehmlX6cYjjMz3BTO1Jk/SHo1rsky8tapkU6zw=; fh=YX2iNuZ24uXZKLc5imLPbVzzJTv3ePp2Ma09cBHvnnc=; b=sXVwdDMKvqxZ3KYe6XcVnnLosS6Dd0JyhegRIdOArhzUpe5MpqJW6lZzhRA3r5wRjb hSe4RC/TFcUHxhD+LEvMQke63JWFC4HjtC3kV7Bkcm1slWo/rou8LIRP0vj9sTLiskOY 2WD+F4ZkGsDJyllas44mlSe9LisAf8t7efuqote+Oht3r9cAZgjn0Lo0B4Ts1pMdIP8p LHSZIkv3vJtCA3ik/iGZ5xWAvjYp2td4mpYDyvAoBBDetE9jCZwUQo2QBXhGgO2REFza aaK25mLl2yfbwy+s46lidJ82tHktc0sfEOXuKXZqgrbIaurmdwuqy1SuGeaXN2JjO0C7 i5yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020aa7c6cd000000b0051dd1c4b760si910638eds.630.2023.07.29.12.36.32; Sat, 29 Jul 2023 12:36:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbjG2TJK (ORCPT + 99 others); Sat, 29 Jul 2023 15:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjG2TJJ (ORCPT ); Sat, 29 Jul 2023 15:09:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C2210C0; Sat, 29 Jul 2023 12:09:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 05B8A60288; Sat, 29 Jul 2023 19:09:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E1ADC433C7; Sat, 29 Jul 2023 19:09:03 +0000 (UTC) Date: Sat, 29 Jul 2023 15:09:01 -0400 From: Steven Rostedt To: Josh Poimboeuf Cc: Valentin Schneider , 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?B?V2Vpw59zY2h1aA==?= , 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 Message-ID: <20230729150901.25b9ae0c@rorschach.local.home> In-Reply-To: <20230726194148.4jhyqqbtn3qqqqsq@treble> References: <20230720163056.2564824-1-vschneid@redhat.com> <20230720163056.2564824-3-vschneid@redhat.com> <20230726194148.4jhyqqbtn3qqqqsq@treble> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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++) ; -- 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; > > + >