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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 BD9D1C433ED for ; Fri, 9 Apr 2021 14:57:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FA07610E5 for ; Fri, 9 Apr 2021 14:57:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FA07610E5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUsZx-0008Nk-3j for qemu-devel@archiver.kernel.org; Fri, 09 Apr 2021 10:57:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUsZ0-0007WW-3W for qemu-devel@nongnu.org; Fri, 09 Apr 2021 10:56:53 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:38526) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lUsYy-0007Z8-9r for qemu-devel@nongnu.org; Fri, 09 Apr 2021 10:56:49 -0400 Received: by mail-wr1-x433.google.com with SMTP id w4so2187198wrt.5 for ; Fri, 09 Apr 2021 07:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=YvHq1wtiylmBZ/fLtqU0SAhkEqotrOTWBp6a4PlVVEI=; b=ObVEs6d9T0josJav3mJPdMJ8B/u+UFLMv+McnTsDYXEEnPKpCu2mzmbGHqz6FQv0Ta HN9p05N6lzqAyPpqANse1zfO6/S4PomjdEzZqDJUP6Ym4xNaWmh+d38dGBsZeuqOyBiL E0yTBhPJac9ckwReMj1AEAf9pODs/SAwwI1C6DM3lS3x2KvhY62IDYK8AT2eQj8aU5I2 jitd76cz554Gi9aoEUftINa1gy72jT5SK9XR+qbUoVVN9gRCoAxYWoPN4Uc9Bgk4/jcd iiFGaMomyJoXeC1a1Rxm9F3SHK9KY8ohuq9M8XFYcpdjzbdD5cgo7iGltz8XwjelILOC MFcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version:content-transfer-encoding; bh=YvHq1wtiylmBZ/fLtqU0SAhkEqotrOTWBp6a4PlVVEI=; b=smPzVb4rXuWTtsxVcStw+O4p0zmHyVVSfWH+ku/ENX+6miUw+Qv266Sml4rzDXjdmh Mkn0AsnVCRlRyqSFwdLYhY8MUPsf01MolemwU6YTdma8r3FRqncmmrZS4oyIYY2ItF/1 RYkMHGxEQqCjnrIi6/sWqqE1Ak7i5qu8svT0qE2Ys9yiCVSS9sViDTOAqR4ppCukXwLI iIFI8e+2/LADqK9G4xe4Z6AhYEmFmcjcYZvVr5Z8Bx0c+Z+pqAfNQ/L9Qm5PsVk1ONdi NK/eIXUIjGUIHFrxQiTDjSqFUx2pqOvEKPxdlu9kr6dmwcEeNe9Loxx4NsBJr91f43NA Fsvg== X-Gm-Message-State: AOAM531zsTrczTuOsmz+hiNGOIKtxZ2m0xGEAB8Jirmpz82dzT9OvAGK DPUJc++AvIy3qD/R3QV81Ojy+w== X-Google-Smtp-Source: ABdhPJy5zw5oKbES2jaodnTI83Pjw/4Ctb2ISP4yQ0oegkZ4tuRp6Wb0m3x/TjZou0Sz6/ojDndgpQ== X-Received: by 2002:adf:fbcc:: with SMTP id d12mr17913652wrs.151.1617980205692; Fri, 09 Apr 2021 07:56:45 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m2sm3970515wmq.6.2021.04.09.07.56.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 07:56:44 -0700 (PDT) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 10DA61FF7E; Fri, 9 Apr 2021 15:56:44 +0100 (BST) References: <20210409100627.451573-1-groug@kaod.org> User-agent: mu4e 1.5.11; emacs 28.0.50 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Greg Kurz Subject: Re: [PATCH] virtiofsd: Fix side-effect in assert() Date: Fri, 09 Apr 2021 15:56:36 +0100 In-reply-to: <20210409100627.451573-1-groug@kaod.org> Message-ID: <87im4vsdzn.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: virtio-fs@redhat.com, qemu-devel@nongnu.org, misono.tomohiro@jp.fujitsu.com, Stefan Hajnoczi , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Greg Kurz writes: > It is bad practice to put an expression with a side-effect in > assert() because the side-effect won't happen if the code is > compiled with -DNDEBUG. > > Use an intermediate variable. Consolidate this in an macro to > have proper line numbers when the assertion is hit. > > virtiofsd: ../../tools/virtiofsd/passthrough_ll.c:2797: lo_getxattr: > Assertion `fchdir_res =3D=3D 0' failed. > Aborted > > 2796 /* fchdir should not fail here */ > =3D>2797 FCHDIR_NOFAIL(lo->proc_self_fd); > 2798 ret =3D getxattr(procname, name, value, size); > 2799 FCHDIR_NOFAIL(lo->root.fd); > > Fixes: bdfd66788349 ("virtiofsd: Fix xattr operations") > Cc: misono.tomohiro@jp.fujitsu.com > Signed-off-by: Greg Kurz Reviewed-by: Alex Benn=C3=A9e --=20 Alex Benn=C3=A9e