Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp707650pxj; Wed, 16 Jun 2021 11:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2dGnsJUFyKETBhcb79/CUjmaED6wibF1fzveJQp9FG8YXGF8nqd5CSk3NU8akgPqhgdve X-Received: by 2002:a05:6402:511:: with SMTP id m17mr1383359edv.1.1623868840725; Wed, 16 Jun 2021 11:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623868840; cv=none; d=google.com; s=arc-20160816; b=ujFja+0+YmbXrB+DjGN0Ji4fl348TlW/X+q6y+09twaA51VpkXYvbWYcIgAtVFovcg 3+2+mog+f3N+zR0YBbzmGpYUAxZKxNkpq2e5nQ6WQUEXoV5QjQ85P4mrEQcbUn07Iilg sy5D40LOpkNohnGqNVqlF936wyN3IVMZBU5EqFz/1ybKdd14SIYJsw9BQkcOPb62kzOB E3uNs8ty9NUQZ8MMVUYzTIyc9OTCJ4ttFPjDHkHxeQYtg8UwoYUBDefVR5NaJ/m9aJ7N 8njANxuc9ihzJ2U2RHT22PgUhWmDr9Ca97F7POXVG75QhRcxWU48ztfe9P3OnLTzjQ4g Rpvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=aRdZ54HD2Y71Mzeckrvw4hXodqyFRR35GmYM5eMm8B0=; b=icsPYlrCQrGS7PYKW6OPvMo1SNLYl8EVv4Y0TecpPwNDxaGq1++zMoYkX62CR7srVa iBZSRLJ10o7H5zeHN7g4nFWHy5cZOfJkS8QXW54wD1jfc+KCF+k5mx1YERIU9CeHB/kt 2EXO482sbshkw0MyyJqhTNBjPgRstmD65dNpqRx995nOkD6ibRVxAyfj6sEXoGlKArwT AaPT6FsuT7ShA4aWmRYNPjunozE9sSonNRJmYXobxqb+kVbiLhHfajyCkh/l0XIHnUMK yagw9rBkSFpmRTZSDF16Mb6yNqYIGTxNbyV5E1oE3gDcfVU7aCmtXjQ34TT9/bSEs5lt 4Teg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L9rJClLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f27si3137922eje.120.2021.06.16.11.40.15; Wed, 16 Jun 2021 11:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L9rJClLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233046AbhFPM6v (ORCPT + 99 others); Wed, 16 Jun 2021 08:58:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47633 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232452AbhFPM6u (ORCPT ); Wed, 16 Jun 2021 08:58:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623848204; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aRdZ54HD2Y71Mzeckrvw4hXodqyFRR35GmYM5eMm8B0=; b=L9rJClLKegKis89Uu55RwiyoXtdx5Oz6tmRDGbV+VZFm+bMRpCXnPem030SJH+0GtvELP1 cJAZYYgE1WWKzUC7V5A+eOnS3qWeWotbjHb76lcq/DeYR3VBxSb1wIWKee98uq8nhynRYV DqpriUdVnTfrmM4LdNS6R1u5mo7QseY= Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-zy_S-8H_MxSHgxwFXVVd3g-1; Wed, 16 Jun 2021 08:56:43 -0400 X-MC-Unique: zy_S-8H_MxSHgxwFXVVd3g-1 Received: by mail-oi1-f200.google.com with SMTP id b185-20020acab2c20000b02901f6dd5f89fbso974664oif.10 for ; Wed, 16 Jun 2021 05:56:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=aRdZ54HD2Y71Mzeckrvw4hXodqyFRR35GmYM5eMm8B0=; b=ORFK94ya/b42ihjLKHLvcIropK72bDs2VDqPxVNTwMcq/ZFWp5pNXZu4YE297oD9FC Hff/OPPz227hfwAdoZ0srHg0dqaoRM8gaROfh1xw/YlNL4KbCjpEny0O+oBmC/ZjxYD5 Pvdxcl2QQUJP6Msh9bcJj3JH52SrUcp9BZA8S6GI/TYK4EbeBZtEnnLdZ3zMq3Xss+DL ategk8GXoGNtRq1FaWvsQvU6KkUnU6TibPtvyfIbSDu0IBHJZttzCH2Ys5sAx49D1Rw/ lrsTEO/X80bukbKuMD2NnNMPN9Tm9O3oT3DQoCowo5Yx0w5gQo0mDykEyyvJ2UJB11O4 w4VA== X-Gm-Message-State: AOAM531kFjAoTN71tfm4FgSbd2wC6gL9Jt1siLgWTLaqE/3dZDAVxYoo o9ccghIKwjpTp3liyIcNOFOwfSJ3qAqYNh5MdKJMRlDBemRj110XH+WKchMnneTxbKrKx//qMZz ybMNb6HZuFizWyEYE3Nwf0VnC3yPfov2na2GI9K+CiZ8U7B1folR0kKe2rIhrQ9w1Ngp2y88= X-Received: by 2002:a4a:4c8f:: with SMTP id a137mr3994323oob.65.1623848202374; Wed, 16 Jun 2021 05:56:42 -0700 (PDT) X-Received: by 2002:a4a:4c8f:: with SMTP id a137mr3994292oob.65.1623848202112; Wed, 16 Jun 2021 05:56:42 -0700 (PDT) Received: from localhost.localdomain (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id p10sm522032otf.45.2021.06.16.05.56.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Jun 2021 05:56:41 -0700 (PDT) Subject: Re: [PATCH] afs: fix no return statement in function returning non-void To: Zheng Zengkai , Randy Dunlap , Linus Torvalds Cc: David Howells , Hulk Robot , linux-afs@lists.infradead.org, Marc Dionne , linux-fsdevel , Linux Kernel Mailing List References: <162375813191.653958.11993495571264748407.stgit@warthog.procyon.org.uk> <051421e0-afe8-c6ca-95cd-4dc8cd20a43e@huawei.com> From: Tom Rix Message-ID: <200ea6f7-0182-9da1-734c-c49102663ccc@redhat.com> Date: Wed, 16 Jun 2021 05:56:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <051421e0-afe8-c6ca-95cd-4dc8cd20a43e@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/15/21 8:15 PM, Zheng Zengkai wrote: > Oops, Sorry for the late reply and missing the compilation details. > >> On 6/15/21 5:32 PM, Linus Torvalds wrote: >>> On Tue, Jun 15, 2021 at 4:58 PM Randy Dunlap >>> wrote: >>>> Some implementations of BUG() are macros, not functions, >>> Not "some", I think. Most. >>> >>>> so "unreachable" is not applicable AFAIK. >>> Sure it is. One common pattern is the x86 one: >>> >>>    #define BUG()                                                   \ >>>    do {                                                            \ >>> instrumentation_begin();                                \ >>>            _BUG_FLAGS(ASM_UD2, 0);                                 \ >>> unreachable();                                          \ >>>    } while (0) >> duh. >> >>> and that "unreachable()" is exactly what I'm talking about. >>> >>> So I repeat: what completely broken compiler / config / architecture >>> is it that needs that "return 0" after a BUG() statement? >> I have seen it on ia64 -- most likely GCC 9.3.0, but I'll have to >> double check that. > > Actually we build the kernel with the following compiler, config and > architecture : > > powerpc64-linux-gnu-gcc --version > powerpc64-linux-gnu-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 > Copyright (C) 2019 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > PURPOSE. > > CONFIG_AFS_FS=y > # CONFIG_AFS_DEBUG is not set > CONFIG_AFS_DEBUG_CURSOR=y > > make ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- -j64 > > ... > > fs/afs/dir.c: In function ‘afs_dir_set_page_dirty’: > fs/afs/dir.c:51:1: error: no return statement in function returning > non-void [-Werror=return-type] >    51 | } >       | ^ > cc1: some warnings being treated as errors > powerpc64 gcc 10.3.1 is what I used to find this problem. A fix is to use the __noreturn attribute on this function and not add a return like this -static int afs_dir_set_page_dirty(struct page *page) +static int __noreturn afs_dir_set_page_dirty(struct page *page) and to the set of ~300 similar functions in these files. $ grep -r -P "^\tBUG\(\)" . If folks are ok with this, I'll get that set started. Tom >>> Because that environment is broken, and the warning is bogus and wrong. >>> >>> It might not be the compiler. It might be some architecture that does >>> this wrong. It might be some very particular configuration that does >>> something bad and makes the "unreachable()" not work (or not exist). >>> >>> But *that* is the bug that should be fixed. Not adding a pointless and >>> incorrect line that makes no sense, just to hide the real bug. >> . >> >