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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2830C433FE for ; Fri, 27 May 2022 06:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344462AbiE0GvA (ORCPT ); Fri, 27 May 2022 02:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344522AbiE0Gu4 (ORCPT ); Fri, 27 May 2022 02:50:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 925CCED8F2 for ; Thu, 26 May 2022 23:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653634254; 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: in-reply-to:in-reply-to:references:references; bh=KwscvJb+e3wCc50yy7+Oyvg5tXhryYMBM/Mq6KPfxIo=; b=WXgVfsqZOiY6hqWMKT+sS9hWI+1UBMDCMb31Y7xgmCSMqtkGrMN44tslRukkxmokpkhfep gm8O0CNGaGVSD2Nw3kYRdYSH5M5kQ+tJze6V7/3X2okAcx5ayXgi5LglW97pmhfJc44dJz qB2Os1gxewTCs7vkNcYJlDHZSpDeoeE= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-178-gkt9PhVyOiCoMnuOhK38Qw-1; Fri, 27 May 2022 02:50:52 -0400 X-MC-Unique: gkt9PhVyOiCoMnuOhK38Qw-1 Received: by mail-qt1-f200.google.com with SMTP id f40-20020a05622a1a2800b002fcc151deebso2830502qtb.4 for ; Thu, 26 May 2022 23:50:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KwscvJb+e3wCc50yy7+Oyvg5tXhryYMBM/Mq6KPfxIo=; b=n5fD5jlHbsCb5NvrQCJIfDawLNXnvXPsfh0rHY6jH85Syu/7S81QxFuyOUh/fwjyQY cq15HrP5NzI6hF2MIcdO8fmkGMZH/kas8f3IUpaTc/GVfZHozWj2ZWSfqf1emq3J2kOw P+nRcRqdjzoJJts26QCiT7NLkqEPdET88kvWZpVmW95t53EwEZOhbHv4j9SBk85lPCmY nYQUzRopwEX4Pa/UZeJh0rp7CwB4B9vT0KQc2oQ8KcQUqFlQucCI7K//kI/y5dhTfqzW 6hiqMjmfoOQdun0+hJycUQCO3MOtPgbl1c7X/gZpQcUDXT8+OTpK9gAPqIVVaFjs51QX sgCw== X-Gm-Message-State: AOAM531Q0+50fzupr4X2QlI1Zht2MCiPb6eoGQqDUyXZKpMywb0+F09N /gvcWUUY3AcSvAIp6K3xncKrykK/90JiH7OEIOK+HYpaFlNKvR/DQos345uSJp1ZMDJit1of9Z2 do+ezVacurbeKaY2DJyYBGfWyVvix9rdC X-Received: by 2002:ac8:4e81:0:b0:2f9:34e4:8955 with SMTP id 1-20020ac84e81000000b002f934e48955mr19432025qtp.459.1653634252365; Thu, 26 May 2022 23:50:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywUtKw1p3mNXU5kTpnVECY4gR+23BPRrwgtbbZy68mg1DnclyCldN2lpPi96HQHPp+NMNAgvooJ44JkNz4TYU= X-Received: by 2002:ac8:4e81:0:b0:2f9:34e4:8955 with SMTP id 1-20020ac84e81000000b002f934e48955mr19432002qtp.459.1653634252144; Thu, 26 May 2022 23:50:52 -0700 (PDT) MIME-Version: 1.0 References: <20220525105922.2413991-1-eperezma@redhat.com> <20220525105922.2413991-3-eperezma@redhat.com> <20220526090706.maf645wayelb7mcp@sgarzare-redhat> <20220526132038.GF2168@kadam> <20220526190630.GJ2168@kadam> In-Reply-To: <20220526190630.GJ2168@kadam> From: Eugenio Perez Martin Date: Fri, 27 May 2022 08:50:16 +0200 Message-ID: Subject: Re: [PATCH v3 2/4] vhost-vdpa: introduce STOP backend feature bit To: Dan Carpenter Cc: Stefano Garzarella , "Dawar, Gautam" , "Michael S. Tsirkin" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , Jason Wang , Zhu Lingshan , "martinh@xilinx.com" , "ecree.xilinx@gmail.com" , Eli Cohen , Parav Pandit , Wu Zongyong , "dinang@xilinx.com" , Christophe JAILLET , Xie Yongji , "lulu@redhat.com" , "martinpo@xilinx.com" , "pabloc@xilinx.com" , Longpeng , "Piotr.Uminski@intel.com" , "Kamde, Tanuj" , Si-Wei Liu , "habetsm.xilinx@gmail.com" , "lvivier@redhat.com" , Zhang Min , "hanand@xilinx.com" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, May 26, 2022 at 9:07 PM Dan Carpenter wrote: > > On Thu, May 26, 2022 at 07:00:06PM +0200, Eugenio Perez Martin wrote: > > > It feels like returning any literal that isn't 1 or 0 should trigger a > > > warning... I've written that and will check it out tonight. > > > > > > > I'm not sure this should be so strict, or "literal" does not include pointers? > > > > What I mean in exact terms, is that if you're returning a known value > and the function returns bool then the known value should be 0 or 1. > Don't "return 3;". This new warning will complain if you return a known > pointer as in "return &a;". It won't complain if you return an > unknown pointer "return p;". > Ok, thanks for the clarification. > > As an experiment, can Smatch be used to count how many times a > > returned pointer is converted to int / bool before returning vs not > > converted? > > I'm not super excited to write that code... :/ > Sure, I understand. I meant if it was possible or if that is too far beyond its scope. > > > > I find Smatch interesting, especially when switching between projects > > frequently. Does it support changing the code like clang-format? To > > offload cognitive load to tools is usually good :). > > No. Coccinelle does that really well though. > Understood. Thanks! > regards, > dan carpenter >