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.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 826A2C433DF for ; Thu, 8 Oct 2020 18:23:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22A8322201 for ; Thu, 8 Oct 2020 18:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbgJHSX5 (ORCPT ); Thu, 8 Oct 2020 14:23:57 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:37296 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbgJHSX5 (ORCPT ); Thu, 8 Oct 2020 14:23:57 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kQaa3-0003dS-IM; Thu, 08 Oct 2020 18:23:55 +0000 To: Jens Axboe Cc: Alexander Viro , linux-fsdevel , io-uring@vger.kernel.org, "linux-kernel@vger.kernel.org" From: Colin Ian King Subject: re: io_uring: process task work in io_uring_register() Message-ID: Date: Thu, 8 Oct 2020 19:23:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Hi, Static analysis with Coverity has detected a "dead-code" issue with the following commit: commit af9c1a44f8dee7a958e07977f24ba40e3c770987 Author: Jens Axboe Date: Thu Sep 24 13:32:18 2020 -0600 io_uring: process task work in io_uring_register() The analysis is as follows: 9513 do { 9514 ret = wait_for_completion_interruptible(&ctx->ref_comp); cond_const: Condition ret, taking false branch. Now the value of ret is equal to 0. 9515 if (!ret) 9516 break; 9517 if (io_run_task_work_sig() > 0) 9518 continue; 9519 } while (1); 9520 9521 mutex_lock(&ctx->uring_lock); 9522 const: At condition ret, the value of ret must be equal to 0. dead_error_condition: The condition ret cannot be true. 9523 if (ret) { Logically dead code (DEADCODE) dead_error_begin: Execution cannot reach this statement: 9524 percpu_ref_resurrect(&ctx->refs); 9525 ret = -EINTR; 9526 goto out_quiesce; 9527 } 9528 } 9529 Colin