Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2393985rdb; Mon, 20 Nov 2023 09:35:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMJqM0tFCunNnn9J43hE1AgZvMqlRkpIBV2Au/4W+ag3L3oP/rt/8+vFzk30UQGwqSIDzc X-Received: by 2002:a05:6a00:17a9:b0:6be:265:1bf6 with SMTP id s41-20020a056a0017a900b006be02651bf6mr7562739pfg.32.1700501713271; Mon, 20 Nov 2023 09:35:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700501713; cv=none; d=google.com; s=arc-20160816; b=W+02wYRCUhB1HIcmPS8zhzMMAF8HA/0wMF60hq8cJm/kJqCGvxD4z7oZbD+lb/FFrf gYGsEuIZVSYFc13yb3gqY7+za7VeafMIFk3I6y9t8XOlF0hT2bH3L0MmLT5cmIEpvMTr g34zdQe5IGNAAd5Ot410Ltifc2Hvn9Ly7J+k0ccjFfi/uCKk3B7ZgrOJfE5WlZTxrb3C NO4WXckMPxjqR4MWzcokxfv/zMgxULI7yjTheW8BGrzLIbbk4+f+Pj+zXaNjeFhtEo/r YIQtPedKv1XYkAGrYuV5lbxbwUEmIciw5pQhwdupidDYlmk5soXcgVOotLcrlGig/kxm ecWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Nk53AN5wyP0ZFoblpJ70kJGg6hx8KTXpXaLODTVSLlY=; fh=g72LIOrfhsIrEmaeIp1rBfwBMED9bInTL3ohqX4Lvyc=; b=0W23cx59gbcfPnEV7qLSWUiXNnkkrh8a/YdLt3pb3pVYzKAooLYhDkqKLnoBK3kAuq c7HqC85Nf5iTjx4Wg5dAreDAeCV6D8woYTPqsjCMXbXHpkYymsu0a4vAK63WOqpvmdQV 6sgs2yZ3nlgRWC3gl07CveYyZSOg5PyxjpuF0edNr5IT2/LekcMlCgMkZRJoOq0d7nXx zsyqxImtWxq7h2/wOqXt9k+DBHVNEkKZYEs4WEx+Llaht0HAcaH9TYvlH9hMKLCBpTOt NIt3mDesCJDJ2a4ABrmOvP53YhXxbtRZOeDBEEpO2oPq1rx7YwQkVNVeSEd3+h/0ND0e 9Chw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tyVraxvY; 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=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f22-20020a631016000000b005a9b2800a08si8604784pgl.783.2023.11.20.09.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:35:13 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=tyVraxvY; 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=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C86EB80AE21D; Mon, 20 Nov 2023 09:35:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233861AbjKTRek (ORCPT + 99 others); Mon, 20 Nov 2023 12:34:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbjKTReg (ORCPT ); Mon, 20 Nov 2023 12:34:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEFDBE for ; Mon, 20 Nov 2023 09:34:32 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D0F9C433C7 for ; Mon, 20 Nov 2023 17:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700501672; bh=l5y25bSfyuTDCqjIuzPL1MkOl4MXmmQUXlmyQFMQjLY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tyVraxvY2BEJuhXBKZKHI/OF3kkdyJl/Besik/yWhboY3Gtj9Y8jeKsTTZO7eK7Qm XEM9TqDQTDt2C0X6uhfxm3eFgeLfGNxdOehskE8OFRF20DoEEc8dwC918SkB2fv90q KkQd66d38c+vJHjouWPX6sQQtq2IV4GB7vmBtabJbl6jmitpAdu6Gu104Azjr6Eeou /ZkpDTWlDPZ2WpgZpZ456gNPVb8IfBF7KpTr91lgpdp1ioc8DCL2e7pNA4ONHMARXN pj+QVYIn6fRD/EIy2YWAU3dpW0y0qWxZEV2VshBJdaQgTOi3wzODSO6Xb96wDq08Ds fntl/0Hqqz+FA== Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-28120aa1c24so3126142a91.0 for ; Mon, 20 Nov 2023 09:34:32 -0800 (PST) X-Gm-Message-State: AOJu0Yx4LNAFPrDkHDWgYtkRBDdLF9rKD2M/ztn1T/kS2J06NfMGlyyR gFdUXwgthBXTlv6mdgFrKUNmkRePmGJIv+7zQA9Enw== X-Received: by 2002:a17:90b:1b4f:b0:281:1c2e:9e6a with SMTP id nv15-20020a17090b1b4f00b002811c2e9e6amr5676311pjb.39.1700501671895; Mon, 20 Nov 2023 09:34:31 -0800 (PST) MIME-Version: 1.0 References: <20231119194740.94101-1-ryncsn@gmail.com> <20231119194740.94101-2-ryncsn@gmail.com> In-Reply-To: From: Chris Li Date: Mon, 20 Nov 2023 09:34:20 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 01/24] mm/swap: fix a potential undefined behavior issue To: Kairui Song Cc: Matthew Wilcox , linux-mm , Andrew Morton , "Huang, Ying" , David Hildenbrand , Hugh Dickins , Johannes Weiner , Michal Hocko , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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]); Mon, 20 Nov 2023 09:35:05 -0800 (PST) Hi Kairui, On Mon, Nov 20, 2023 at 3:15=E2=80=AFAM Kairui Song wrot= e: > > Chris > > Hi, Chris and Matthew. > > Thanks for the comments. > > Right, it's just a language syntax level thing, since "->" have a > higher priority, so in the syntax level it is doing a member access > first, then take the address. By C definition member access should > not happen if the object is invalid (NULL). Only a hypothesis problem > on paper... The dereference only shows up in the abstract syntax tree level. According to the C standard there are expansion and evaluation phases after that. At the evaluation phase the dereference will turn into pointer arithmetic. Per my understanding, the dereference never actually happens, due to the evaluation rules, not even in theory. > This is indeed not needed since in reality it's just pointer > arithmetic. I'm OK dropping this. Thanks Chris