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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70180C433ED for ; Fri, 7 May 2021 02:24:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D76406113D for ; Fri, 7 May 2021 02:24:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D76406113D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2BF9D6B0070; Thu, 6 May 2021 22:24:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2487B6B0071; Thu, 6 May 2021 22:24:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09BCA6B0072; Thu, 6 May 2021 22:24:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id DE5726B0070 for ; Thu, 6 May 2021 22:24:55 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 93BFD181AEF2A for ; Fri, 7 May 2021 02:24:55 +0000 (UTC) X-FDA: 78112842150.37.96CCA06 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by imf26.hostedemail.com (Postfix) with ESMTP id 0463D40002F2 for ; Fri, 7 May 2021 02:24:42 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id b7so9637903ljr.4 for ; Thu, 06 May 2021 19:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0OkFpp3Tpm3CAdH//vkbEPOvgMuJGJC1iISmLvW+Rbc=; b=QP6NoIQh0vOG4cXH4h84nqiB/yQHy0e/v9/r7M7dZmAJ51A/oYPyfk4ZU+obfOPXQ6 NWD3DLA1YTziKlS21/VSsG0cd9+6NUgzmqL4drba3HDDUxgpTBq1PVmkrk8v8H4V1ulB Cl3IeRQuC06e9OEbTtFkwg5XT5J4dXt0F68+k= 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=0OkFpp3Tpm3CAdH//vkbEPOvgMuJGJC1iISmLvW+Rbc=; b=QREI9+9eEK/8txKWGhhKtdU/GyblJOiRMzjL2TCbZx8lVPro4jbZP+kEaw1LhRDI2m Sgx3XvwEg2ac0TIq8/vI9IoIL47lr58oh5pJT5DFSl4hxbwEV+rNftNoBeo7OjAzz1wZ QVq8RKEPp+Mb0eOc9MUAKY0jkApGTNb4pkGqgQW9M1kHSo7cI4iYh1SKeyrVIevTr7cz dDl+spGVxgwazIlA0JO9SJDUykxER4X6H//aMEbiT0EGrIAZrbuohnwNsuURKFNea2ju Uj8p4TnQsxXvhRoqBLAS0EZ5VHMZy2/k7JadBJz/CaTVey1BVENuz7wPJ3lgF1IF3HqR 9XHg== X-Gm-Message-State: AOAM530ivlh3+AzqA1Gy3qPzYNuVsHHCIk6BHWbgUZwWnkW9nd+9VOGA 6a39WRw/z+c4wmnZ1fkInONeVtMnrf1rnIwy X-Google-Smtp-Source: ABdhPJxOhSmWrj+YWmaw9E6PKZGAvQLpDub/07aiJGPqt8wnHcrXr62Xk3GGdq5Zoyf8hdoo6ByaXw== X-Received: by 2002:a2e:8512:: with SMTP id j18mr6003707lji.196.1620354293283; Thu, 06 May 2021 19:24:53 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id r5sm1554152ljk.90.2021.05.06.19.24.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 May 2021 19:24:52 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id b7so9637870ljr.4 for ; Thu, 06 May 2021 19:24:52 -0700 (PDT) X-Received: by 2002:a05:651c:3de:: with SMTP id f30mr5755440ljp.251.1620354292233; Thu, 06 May 2021 19:24:52 -0700 (PDT) MIME-Version: 1.0 References: <20210506180126.03e1baee7ca52bedb6cc6003@linux-foundation.org> <20210507010213.V8MhqooKS%akpm@linux-foundation.org> In-Reply-To: <20210507010213.V8MhqooKS%akpm@linux-foundation.org> From: Linus Torvalds Date: Thu, 6 May 2021 19:24:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 04/91] proc: save LOC in __xlate_proc_name() To: Andrew Morton Cc: Alexey Dobriyan , Linux-MM , mm-commits@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=QP6NoIQh; dmarc=none; spf=pass (imf26.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.180 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org X-Rspamd-Server: rspam03 X-Stat-Signature: bach3mzssq5yei9hrz6rk6hm8mprhaz5 X-Rspamd-Queue-Id: 0463D40002F2 Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail-lj1-f180.google.com; client-ip=209.85.208.180 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620354282-672885 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, May 6, 2021 at 6:02 PM Andrew Morton wrote: > > From: Alexey Dobriyan > Subject: proc: save LOC in __xlate_proc_name() .. > + while ((next = strchr(cp, '/'))) { Please don't do this. Yes, gcc suggests that double parentheses syntax around an assignment to avoid warnings. gcc is wrong, and is being completely stupid. The proper way to avoid the "assignment in conditional" warning is to (surprise, surprise) USE A CONDITIONAL. So that while ((next = strchr(cp, '/'))) { is the crazy rantings of a misguided compiler. No sane human should ever care about some odd double parenthesis syntax. We're not writing LISP, for chrissake. The proper way to write this is while ((next = strchr(cp, '/')) != NULL) { which makes sense to not just a machine, but to a human, and avoids the whole "assignment used as a conditional" warning very naturally. See? Now it uses a conditional as a conditional. Doesn't that make a whole lot more sense than the crazy ramblings of a broken machine mind? I fixed it up manually, I just wanted to rant against this kind of "mindlessly take advice from the compiler without thinking about it". Linus