Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4985191rdb; Fri, 15 Sep 2023 20:42:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzfgxeI/AtIqidbSMGKxgptZeEfBJp0tKXhQ9SriffX5TdOOZQDeJST4nmmHaS0OOlyW4j X-Received: by 2002:a05:6870:a2c9:b0:1d5:9b10:f777 with SMTP id w9-20020a056870a2c900b001d59b10f777mr3959814oak.12.1694835744298; Fri, 15 Sep 2023 20:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694835744; cv=none; d=google.com; s=arc-20160816; b=iLKCZ8rXHIewsy1tIqfLRdUo8et0ef4pHOjsXCKSTSD7G7ytlWaCI6iAXjYMHzCPfZ gC0x71oaeBK+iQeEKvWLW10FiGMj23ZHbPwb7wHWeUPNMdSJq1Y8jbyRntq6WpWlNA8O wOVLr8RtDTyVPhs8sFhRXlvYHWSp+DZG4budT3NGZtzJtzqIxhmHH2SqKN3jhrjf7zLK KNq+eEUk+NKquwbcQsRwmA4PaDJSp9pwdDvBRrWNcau4iygckjyGvKztj6Ar1y3M6yiE 3C8HvDqsw6IbycbZxWE0l/kzgeSJZt+qLJZeXpr9GlaBZRutTK+wg8CbDG/I3MWF9IJk a8Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Vvpdf+bQmSjjcViV7hWhTMDmVZmln8TozUHjeEqwR7o=; fh=voruMRgGJb12M4Ne4ylvCDBmt1PO4dueNyf8OF9Z7Ig=; b=lDPtDNEUyrW8BH2ZYKZaBDVdpio732p5nwiEiUCoY86/rSalmZuGQHpyQq14W/dGdL dGa0xkE8H06uSrYNu8lI8/iRZST5AKniJ0/HzmQMy+LZolIOHqJcQz7e1dTH3FqMq5w0 8ASnti73NQaSTyxajEIJ2o/c5S+aei2Gbq0hcfNj4mn4UBM+GT4H5GhO2AqfJkQIhqrl /2TyibL0vFhgvKRPt92yTonqhiXDFh18mXsBSSpmcUrjnU3vB2RWv5Yz+U4ZUCoEMxso MllhjvfCnS7aioNQ2mz5R4GQoJhyh0wok0j5+JvY3GTHubwB91D2t3Ax8hwmkU7rgF6h DJIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D0ANqcb2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id cj9-20020a056a00298900b0069022a03d5asi4301496pfb.309.2023.09.15.20.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 20:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D0ANqcb2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6C93783EDDBC; Fri, 15 Sep 2023 13:05:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237125AbjIOUEb (ORCPT + 99 others); Fri, 15 Sep 2023 16:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237096AbjIOUEH (ORCPT ); Fri, 15 Sep 2023 16:04:07 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C16FA210A for ; Fri, 15 Sep 2023 13:04:02 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-d81b803b09aso1385273276.2 for ; Fri, 15 Sep 2023 13:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694808242; x=1695413042; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Vvpdf+bQmSjjcViV7hWhTMDmVZmln8TozUHjeEqwR7o=; b=D0ANqcb2qfJZ/MzHqe0K7IFv17pg4i5cLXikJ3j1/LgJ4Hl8dWDLzF9ERZ3GQTb0gf QQOD2Jw4nVMxuX6R61/Ek29bjEeZxKEmYx3sVIKmj153k++vcc/NVL1x721WiBCulMYx lrHd3ZjG94ib4WmdHYwL4kIOxP9zj3fOry9M4dgL7Zp6mzv9q0gdjaH/K0s0IdybLApY l5oJpT7Ad4wppAGhHuppE72XlA0LFO7dbAOuowavFU+y4jNvtABoys/IBzeXCutLsxJm YiirCPH76Ir+GKMDl472QYzZ/Vgw0BXyZR+P6yMWQmqMxgUFvaBvNbTSm43ONaweuagF ufUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694808242; x=1695413042; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Vvpdf+bQmSjjcViV7hWhTMDmVZmln8TozUHjeEqwR7o=; b=K7HL2veaNHgW/Vaqe4NS8a8XulNdQgZ9cbTPIiYQF5FZTxaZR8U95k0Nf21w6vnyJA buqDSKqf2BipUowVNrynDZnK3+9BEQZ5M0sfeaegPfv3/UoXuT5mTpyaaDTUEoRBtZQ4 gOVZBMBITJm3EasrGk52EyDwyWG9GBUMeXak8pTRqyBBQHp6X2KIbS9m7qe43M1V22x6 VNLaLu88Wr991tods2Vs4JYB54fq5gVd0M1+HKvExy2BYbkH+71jvOJyT5G7eiRATql5 41woZYXzZ3WQUfTIapnV/LWEd9UaX2JYe6Bo1Wj5aR4lsI6ODtfyjeuYvk85u5iOma1N PU3g== X-Gm-Message-State: AOJu0Yw6tvqg9fi2xMSlQAXtxFOOQNXqO99cCH/u0iZBjT/gZCWrEAmh Ahe9CqO2uFfXdSc6yDMi1REzRwY9k1fIu3ZGQGC3Tw== X-Received: by 2002:a25:2d22:0:b0:d7a:e348:1e47 with SMTP id t34-20020a252d22000000b00d7ae3481e47mr2666037ybt.36.1694808242030; Fri, 15 Sep 2023 13:04:02 -0700 (PDT) MIME-Version: 1.0 References: <07c32bf1-6c1a-49d9-b97d-f0ae4a2b42ab@p183> In-Reply-To: From: Bartosz Golaszewski Date: Fri, 15 Sep 2023 22:03:51 +0200 Message-ID: Subject: Re: Buggy __free(kfree) usage pattern already in tree To: Linus Torvalds , Peter Zijlstra Cc: Alexey Dobriyan , linux-kernel@vger.kernel.org, Linus Walleij , akpm@linux-foundation.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 15 Sep 2023 13:05:00 -0700 (PDT) On Fri, 15 Sept 2023 at 21:27, Bartosz Golaszewski wrote: > [snip!] > > Understood. I'll go with a modified version of maybe-sane. I'll send a > v2 tomorrow and make sure to Cc you. > [snip!] One more question wrt the __free() coding style. Is the following acceptable: void foo(void) { char *s __free(kfree) = NULL; do_stuff(); s = kmalloc(42, GFP_KERNEL); } Or does it always have to be: void foo(void) { do_stuff(); char *s __free(kfree) = kmalloc(42, GFP_KERNEL); } ? I guess it would be useful to get these rules into Documentation/process/coding-style.rst at some point as we also have an ongoing discussion about whether scoped guards should always require curly braces[1] even for single statements. Bartosz [1] https://lore.kernel.org/lkml/CAMuHMdVYDSPGP48OXxi-s4GFegfzUu900ASBnRmMo=18UzmCrQ@mail.gmail.com/