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=-6.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS 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 26FEDC433DF for ; Mon, 12 Oct 2020 15:24:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B88C52087E for ; Mon, 12 Oct 2020 15:24:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jhTqLk8z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389874AbgJLPYy (ORCPT ); Mon, 12 Oct 2020 11:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388984AbgJLPYy (ORCPT ); Mon, 12 Oct 2020 11:24:54 -0400 Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB7DAC0613D0; Mon, 12 Oct 2020 08:24:53 -0700 (PDT) Received: by mail-yb1-xb42.google.com with SMTP id n65so9949763ybg.10; Mon, 12 Oct 2020 08:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iPv7827Nls0k4D3zdHYccFHp2qugyVVdkpLdlibXylE=; b=jhTqLk8ziijLvUmU9B6FFv5qWVvghvIypTAAz4yDCb9Tsi07ce4ra6Lli4ckhNWrbA EDa+N9c5x2h9k4XpELr+JUw7zrtC6/HKjyfsYBKxiel+fSM+iDuFaswXd53hTourKfUp ZF69WNsQgr07CooGA4khxMVxCJFStjve1Jhw0I6T35ExN/wINwszRJ2AcDqrmaUsYA/9 MDoIw7DuOQmKE5G4heILz7Sqhy0DeLMTmAmzOj6pebb6Y7WzUBIF2xFEh++TrYse8cK9 +UPxQYwAClmqUW0SApmurYJ9osCJOZnWrz+t0aqH6ZFSYO/4JEfUAI3iUJsTsBfdB4GV ICVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iPv7827Nls0k4D3zdHYccFHp2qugyVVdkpLdlibXylE=; b=g7iChwzBHL/e1B1QlfnxSd0U6iWG6cJ0iL8oR8NPsegS40nHV3a4bvYNz3tUk2HxJL QBMOJuxR8GF2wdsxqmms4nLUYBbenboZmX1PSkIfam/kQ8gnqPQjbTy6UhoY8dfquCIL O7WbdU5b3CWQPBOgV2HK0lySjS+iNeZvkDbgfkbogfY/SsoeKQcSvFUgGkiu/4R2dBL6 xclrMbCI3aGBSZF/ChvkhcOI9SHlfTTrF1oksk2GC5TF3+xTP7hVUS3bSgn3bd4jAdWw Ak2wrrickgPxlohw7DfKWN2KpbjH19vLbe8sz3Oe/025I0Z8sAXAceSsjAsepItCqHIl fe9A== X-Gm-Message-State: AOAM531DucJWz371GIh5IFiRhl4SB6Awv8yRK7gisPbEoaYEjLPwDyy7 n4BcDadrhYAdbkgGwFPS+GiWKgTp8QnXEaQRzOU= X-Google-Smtp-Source: ABdhPJzT3A0THw8y5w7vuVFfaZQvrSDF6frvTQvfecNoHOrr6gPbO1w+ylVW9oKfyAfyhRhKATdYfCiVF3YktX4UYHA= X-Received: by 2002:a25:e046:: with SMTP id x67mr31850217ybg.342.1602516293133; Mon, 12 Oct 2020 08:24:53 -0700 (PDT) MIME-Version: 1.0 References: <20201011205008.24369-1-sudipm.mukherjee@gmail.com> In-Reply-To: From: Sudip Mukherjee Date: Mon, 12 Oct 2020 16:24:16 +0100 Message-ID: Subject: Re: [linux-safety] [PATCH] usb: host: ehci-sched: add comment about find_tt() not returning error To: Lukas Bulwahn Cc: Alan Stern , Greg Kroah-Hartman , linux-kernel , linux-safety@lists.elisa.tech, linux-usb@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lukas, On Mon, Oct 12, 2020 at 3:11 PM Lukas Bulwahn wrote: > > > > On Sun, 11 Oct 2020, Sudip Mukherjee wrote: > > > Add a comment explaining why find_tt() will not return error even though > > find_tt() is checking for NULL and other errors. > > > > Signed-off-by: Sudip Mukherjee > > I get the intent of the comment but there is a large risk that somebody > could remove the find_tt() call before the calling the function and there > is no chance to then see later that the comment is actually wrong. Removing the find_tt() will mean a major rework of the code. > > I guess you want to link this comment here to a code line above and > request anyone touching the line above to reconsider the comment then. > > But there is no 'concept' for such kind of requests to changes and > comments. > > So, the comment is true now, but might be true or wrong later. If it is wrong later due to some code change then I guess someone will need to send a patch to correct the comment. > > I am wondering if such comment deserves to be included if we cannot check > its validity later... I am failing to understand why will you not be able to check its validity later. You just need to read the code to check it. > > I would prefer a simple tool that could check that your basic assumption > on the code is valid and if it the basic assumption is still valid, > just shut up any stupid tool that simply does not get that these calls > here cannot return any error. > > We encountered this issue because of clang analyzer complaining, but it is > clear that it is a false positive of that (smart but) incomplete tool. I dont think it is a false positive. The error return value is not checked and that is true. Only that it is not applicable because of the way the coding is done. > > Do you intend to add comment for all false positives from all tools or are > we going to find a better solution than that? I think tools will always give you some false positives and you will need to read the code to know if its false positive or not. I dont think there is any tool yet which will only give true positives. -- Regards Sudip From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f196.google.com (mail-yb1-f196.google.com [209.85.219.196]) by mx.groups.io with SMTP id smtpd.web11.979.1602516294007291922 for ; Mon, 12 Oct 2020 08:24:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jhTqLk8z; spf=pass (domain: gmail.com, ip: 209.85.219.196, mailfrom: sudipm.mukherjee@gmail.com) Received: by mail-yb1-f196.google.com with SMTP id b138so11373082yba.5 for ; Mon, 12 Oct 2020 08:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iPv7827Nls0k4D3zdHYccFHp2qugyVVdkpLdlibXylE=; b=jhTqLk8ziijLvUmU9B6FFv5qWVvghvIypTAAz4yDCb9Tsi07ce4ra6Lli4ckhNWrbA EDa+N9c5x2h9k4XpELr+JUw7zrtC6/HKjyfsYBKxiel+fSM+iDuFaswXd53hTourKfUp ZF69WNsQgr07CooGA4khxMVxCJFStjve1Jhw0I6T35ExN/wINwszRJ2AcDqrmaUsYA/9 MDoIw7DuOQmKE5G4heILz7Sqhy0DeLMTmAmzOj6pebb6Y7WzUBIF2xFEh++TrYse8cK9 +UPxQYwAClmqUW0SApmurYJ9osCJOZnWrz+t0aqH6ZFSYO/4JEfUAI3iUJsTsBfdB4GV ICVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iPv7827Nls0k4D3zdHYccFHp2qugyVVdkpLdlibXylE=; b=SMCKk0gFu8g0XxF4HzNoAC5oUtEFazGA5IPh1h6x6Ok3G5FiNYmwuyujR2teI8N3oY Xj8C+H0xicaNqX4YMNxcBAdiTE1IHPpycVJWGsAmdpnIyvaE6NcAxY2tsEB3JwbNU90E 8/FnE6CQ2dACUGd1oiItBgr+x0KU3j41rIxROMy9Km4dWS1KkHAYn77hwRsQwwmOI53O QTwgsoasSjqEQ0oMamh9YRD6KisYxuoQr9ThrVcL+tu6rTVpbzoz7nMx33DSdND29h+5 f0/bE+Iz9PUITvRK17nX2/ovrBau6335fpe2YyrN/U7RQpXUPWk7yMGu1fFOVdphmGCo /F5w== X-Gm-Message-State: AOAM532jnShsm3N/+BcsCsXT4BJ47sLPhaSeWlUWGrXGdeTTH+T/6qR3 AeysFn8RvF0tWGGz5ncjfRZoFrQCRlMo8eB4450= X-Google-Smtp-Source: ABdhPJzT3A0THw8y5w7vuVFfaZQvrSDF6frvTQvfecNoHOrr6gPbO1w+ylVW9oKfyAfyhRhKATdYfCiVF3YktX4UYHA= X-Received: by 2002:a25:e046:: with SMTP id x67mr31850217ybg.342.1602516293133; Mon, 12 Oct 2020 08:24:53 -0700 (PDT) MIME-Version: 1.0 References: <20201011205008.24369-1-sudipm.mukherjee@gmail.com> In-Reply-To: From: "Sudip Mukherjee" Date: Mon, 12 Oct 2020 16:24:16 +0100 Message-ID: Subject: Re: [linux-safety] [PATCH] usb: host: ehci-sched: add comment about find_tt() not returning error To: Lukas Bulwahn Cc: Alan Stern , Greg Kroah-Hartman , linux-kernel , linux-safety@lists.elisa.tech, linux-usb@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi Lukas, On Mon, Oct 12, 2020 at 3:11 PM Lukas Bulwahn wrote: > > > > On Sun, 11 Oct 2020, Sudip Mukherjee wrote: > > > Add a comment explaining why find_tt() will not return error even though > > find_tt() is checking for NULL and other errors. > > > > Signed-off-by: Sudip Mukherjee > > I get the intent of the comment but there is a large risk that somebody > could remove the find_tt() call before the calling the function and there > is no chance to then see later that the comment is actually wrong. Removing the find_tt() will mean a major rework of the code. > > I guess you want to link this comment here to a code line above and > request anyone touching the line above to reconsider the comment then. > > But there is no 'concept' for such kind of requests to changes and > comments. > > So, the comment is true now, but might be true or wrong later. If it is wrong later due to some code change then I guess someone will need to send a patch to correct the comment. > > I am wondering if such comment deserves to be included if we cannot check > its validity later... I am failing to understand why will you not be able to check its validity later. You just need to read the code to check it. > > I would prefer a simple tool that could check that your basic assumption > on the code is valid and if it the basic assumption is still valid, > just shut up any stupid tool that simply does not get that these calls > here cannot return any error. > > We encountered this issue because of clang analyzer complaining, but it is > clear that it is a false positive of that (smart but) incomplete tool. I dont think it is a false positive. The error return value is not checked and that is true. Only that it is not applicable because of the way the coding is done. > > Do you intend to add comment for all false positives from all tools or are > we going to find a better solution than that? I think tools will always give you some false positives and you will need to read the code to know if its false positive or not. I dont think there is any tool yet which will only give true positives. -- Regards Sudip