Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp209097pxj; Thu, 3 Jun 2021 04:56:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW4gLljBauM3DSF/3U8OPOXLDQT8LXMqeqcl+ofitaSPV0PkinihngMHXqpn0zQOe8OG80 X-Received: by 2002:a05:6402:44:: with SMTP id f4mr43810211edu.364.1622721381213; Thu, 03 Jun 2021 04:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622721381; cv=none; d=google.com; s=arc-20160816; b=PMeRCCHipKXO7+HeuoHUY5fKClAleLstUJ7mtn2kTL3WopwX1lDA22U/XUI+t7T1to ACZnKmzjMC2Qyb3DystrGSJdWyGI/SOxgTl+Y/XZBUyprxYmBcVpCyYJorI1SESE+RG/ Ew0o9on9nLy2vvqjc/UiIHeWvACVfn+IXTslQlqdMauXAxAfR6O8NJ6Ec3xzWahuMDa5 8NO4RHKUPeWjVL+L/YXlwsjYczawk0q3LKh0y00Pqy/WDORQYzlrkxNmn0v/2tnfE292 MJ6evHuILtQoI6rEcaY1/R39q8KqGoRkWO2ZmFtDm2/OFsTOVdeQEthEOO6f7D4DAGoh 9y4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=rMmMb8lDL1Xd3cp2GLBOgmQ/e6xZ8Wp6BwX8zqPGsUg=; b=yqMKZL9VmiPZSl8eblOKX4egXKQ6AcUwE3YiOBiDYMyGSIuEZG0LJlhI74WfiinbCL a/3hl64oaJxjuccN0IaQG4XSzPDtkcJOpnby6yLyGC/TqwDGQ/erQEK1eW/VH8PVHh8J lSc1iU6ivrJM1dpE3FUl7hLkUUZHdWkZ0Tpi2d4yg7vPpIkRoHnMzdmRs3mlXFfYAR2t NfEKJC3t7TQzNtDUHeQRxn9QsX69ml96Vfw5e2EG7yxO2iHtM5hXQ5szan9H8qShM+5N 0iqv9m43d1kHzRORkCgE/gvvVHS05NlP2J3cc/XjNBDTx86PRZWKJ7f1YhHf17+sbyRU ZyPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uxINjj+J; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si2306974edu.41.2021.06.03.04.55.57; Thu, 03 Jun 2021 04:56:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uxINjj+J; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230092AbhFCL4M (ORCPT + 99 others); Thu, 3 Jun 2021 07:56:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbhFCL4L (ORCPT ); Thu, 3 Jun 2021 07:56:11 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA0EC06174A; Thu, 3 Jun 2021 04:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rMmMb8lDL1Xd3cp2GLBOgmQ/e6xZ8Wp6BwX8zqPGsUg=; b=uxINjj+JqutERZb2g/HO5UqB+j tsoa81rI9VZPpREVTTfKmIyZYUSKaTPS0xV8dyDrWVpwwEsSSFqGrYEvvZoVScFHaEdXU1KdvURd/ +ptMq8/ODkTUe3Dq5OAT4J5foc3sj/2sS1aOHMJdKRq/WgLkVqREhETtBD91WiLtiUQLDOXMb6osE 4RtjeWHtsuxdLvu9Ax032vOQit+TU6lRh+bXfHX8cdxvMHwf6Ykbd2wXkkXW+NCmLde8vS4tgyM0f MUFerQlyFi5KYhckAan8WxHOCbGWcZjy9swY2mH56AtpZRc+QQT/XQiKvca2YxBeLGeDRJEl5An6m bLOEJ1KQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:56918 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lolvd-0002du-6K; Thu, 03 Jun 2021 12:54:25 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lolvc-0003RM-VE; Thu, 03 Jun 2021 12:54:25 +0100 In-Reply-To: <20210603115316.GR30436@shell.armlinux.org.uk> References: <20210603115316.GR30436@shell.armlinux.org.uk> From: Russell King To: Kalle Valo Cc: "David S. Miller" , Jakub Kicinski , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wireless-drivers-next 3/4] net: wlcore: fix bug reading fwlog MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Thu, 03 Jun 2021 12:54:24 +0100 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org With logging enabled, it has been observed that the driver spews messages such as: wlcore: ERROR Calculate of clear addr Clear = 204025b0, write = 204015b0 The problem occurs because 204025b0 is the end of the buffer, and 204015b0 is the beginning, and the calculation for "clear"ing the buffer does not take into account that if we read to the very end of the ring buffer, we are actually at the beginning of the buffer. Fix this. Signed-off-by: Russell King --- drivers/net/wireless/ti/wlcore/event.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/event.c b/drivers/net/wireless/ti/wlcore/event.c index 875198fb1480..8a67a708c96e 100644 --- a/drivers/net/wireless/ti/wlcore/event.c +++ b/drivers/net/wireless/ti/wlcore/event.c @@ -84,6 +84,8 @@ int wlcore_event_fw_logger(struct wl1271 *wl) len = min(actual_len, available_len); wl12xx_copy_fwlog(wl, &buffer[start_loc], len); clear_ptr = addr_ptr + start_loc + actual_len; + if (clear_ptr == buff_end_ptr) + clear_ptr = buff_start_ptr; /* Copy any remaining part from beginning of ring buffer */ len = actual_len - len; -- 2.20.1