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.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 85B72C65BAF for ; Wed, 12 Dec 2018 08:33:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5643620849 for ; Wed, 12 Dec 2018 08:33:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5643620849 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=hxt-semitech.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726785AbeLLIdR convert rfc822-to-8bit (ORCPT ); Wed, 12 Dec 2018 03:33:17 -0500 Received: from mx01.hxt-semitech.com ([223.203.96.7]:34854 "EHLO barracuda.hxt-semitech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726440AbeLLIdQ (ORCPT ); Wed, 12 Dec 2018 03:33:16 -0500 X-ASG-Debug-ID: 1544603579-093b7e7c6213d20002-xx1T2L Received: from HXTBJIDCEMVIW02.hxtcorp.net ([10.128.0.15]) by barracuda.hxt-semitech.com with ESMTP id 1Q6f355qG8b5diUP (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Wed, 12 Dec 2018 16:33:00 +0800 (CST) X-Barracuda-Envelope-From: yanjiang.jin@hxt-semitech.com Received: from controller.hxtcorp.net (10.5.21.105) by HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 12 Dec 2018 16:32:07 +0800 From: Yanjiang Jin To: , CC: , , , , , , , , Subject: [PATCH] PCI/AER: only insert one element into kfifo Date: Wed, 12 Dec 2018 16:32:30 +0800 X-ASG-Orig-Subj: [PATCH] PCI/AER: only insert one element into kfifo Message-ID: <1544603550-14208-2-git-send-email-yanjiang.jin@hxt-semitech.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544603550-14208-1-git-send-email-yanjiang.jin@hxt-semitech.com> References: <1544603550-14208-1-git-send-email-yanjiang.jin@hxt-semitech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.5.21.105] X-ClientProxiedBy: HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) To HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) Content-Transfer-Encoding: 8BIT X-Barracuda-Connect: UNKNOWN[10.128.0.15] X-Barracuda-Start-Time: 1544603580 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA384 X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at hxt-semitech.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.5000 1.0000 0.0000 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.63648 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'commit ecae65e133f2 ("PCI/AER: Use kfifo_in_spinlocked() to insert locked elements")' replace kfifo_put() with kfifo_in_spinlocked(). But as "kfifo_in(fifo, buf, n)" describes: " * @n: number of elements to be added". We want to insert only one element into kfifo, not "sizeof(entry) = 16". Without this patch, we would get 15 uninitialized elements. Signed-off-by: Yanjiang Jin --- drivers/pci/pcie/aer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index a90a919..fed29de 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1064,7 +1064,7 @@ void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, .regs = aer_regs, }; - if (kfifo_in_spinlocked(&aer_recover_ring, &entry, sizeof(entry), + if (kfifo_in_spinlocked(&aer_recover_ring, &entry, 1, &aer_recover_ring_lock)) schedule_work(&aer_recover_work); else -- 1.8.3.1 This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.