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=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 A9E53C433DF for ; Wed, 8 Jul 2020 06:53:37 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 707282075B for ; Wed, 8 Jul 2020 06:53:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="JZMg1ldP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 707282075B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 39F4189423; Wed, 8 Jul 2020 06:53:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0ZJ4lmfEv12k; Wed, 8 Jul 2020 06:53:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id B42E088CE6; Wed, 8 Jul 2020 06:53:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9FAD8C077B; Wed, 8 Jul 2020 06:53:36 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B1928C016F for ; Wed, 8 Jul 2020 06:53:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9D37388B0B for ; Wed, 8 Jul 2020 06:53:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eMbDxlBP-yad for ; Wed, 8 Jul 2020 06:53:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1E01888B03 for ; Wed, 8 Jul 2020 06:53:35 +0000 (UTC) Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 588792075B; Wed, 8 Jul 2020 06:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594191214; bh=g9ZlohxdxkjqpTSIdab6cJipB+jvPoyU/B+zybZjQug=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JZMg1ldP1BXdzQiHMFkXu7aHxwTh64Vlhyckb9kaTg+GWWZzMNEut8mTQb8xJ+Y4D N6v87HtjIX4uGta6CD2crc/ju2GwnO835wcPKSVZaV67/yxL6pytZe0r1v5nIf5b3+ GDOWbSJYBqXmNDU02c6mR1J92fhfjTPWRzjOnU9Q= Date: Wed, 8 Jul 2020 08:53:30 +0200 From: Greg Kroah-Hartman To: Saheed Olayemi Bolarinwa Message-ID: <20200708065330.GA348669@kroah.com> References: <20200707220324.8425-1-refactormyself@gmail.com> <20200707220324.8425-3-refactormyself@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200707220324.8425-3-refactormyself@gmail.com> Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, helgaas@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [Linux-kernel-mentees] [PATCH 2/13] misc: rtsx: Check the return value of pcie_capability_read_*() X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On Wed, Jul 08, 2020 at 12:03:13AM +0200, Saheed Olayemi Bolarinwa wrote: > From: Bolarinwa Olayemi Saheed > > On failure pcie_capability_read_dword() sets it's last parameter, val > to 0. In which case (val & PCI_EXP_DEVCTL2_LTR_EN) evaluates to 0. > However, with Patch 13/13, it is possible that val is set to ~0 on > failure. This would introduce a bug because (x & x) == (~0 & x). > > This bug can be avoided without changing the function's behaviour if the > return value of pcie_capability_read_word is checked to confirm success. > > Check the return value of pcie_capability_read_word() to ensure success. > > Suggested-by: Bjorn Helgaas > Signed-off-by: Bolarinwa Olayemi Saheed Acked-by: Greg Kroah-Hartman _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees