Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp582436ybp; Fri, 4 Oct 2019 01:27:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOWpPsaBJL5NfxWb1CSDQuLfnpdm2RAZsdKgN7EFbyNUkfGueiZN9LFcOJx1AZyDY3A04h X-Received: by 2002:a05:6402:1212:: with SMTP id c18mr13971173edw.259.1570177639380; Fri, 04 Oct 2019 01:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570177639; cv=none; d=google.com; s=arc-20160816; b=JGiPe1Cz471vcmfkGesc9Nv0QLTTT3f/Lx+ZEvdehDDdip/DTqjQwrvw0DDrkWBnhr ojVTVRp8AusFR8HkyeBzyW5Sq8hDTVFcDsgpZG+ZvzUyXkVzvuMaA2yybQ098zevdgxI BjOq7SDZWPfncHiiwNR2noJkYOZHqD/o2VUB0GT+cN32D788mWBtSPtq4alaE8fySeJq 1eK6K3S+88x23+HXPH112koQ1QZLvomTnVxGH7uX4NdzXs3ahF0F50ZOJ4CN8yiGG57D PuDikhkgZaLnHiy5BUmexUNglk0fNsQ1KTtt2ZDhdxkxjapHbr5SdcxwKqOrvKuhS3O1 XUcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=m0IZGO1OMSmC0Bn/Pt54UKIFEBspEgEXw7Mo4uN0eac=; b=IYeF7ylNLHgZc1Eu89lGzED9+GyrjXXu7rasPlGVxf3fTqooOM6d+JtYy/WX0WhvxU L6GU7uZBxMXbdMu8JVDtfaWVjKSisbR1wgo+odQKhddADUyqyhp9DhXFYZVfaFo/hbbm dr56t+fXhfwq943LNIU8oYgU3aBNXOzSZkvCZnAYwDdueW8RC6Up7g5T/V1sUi8vTCSW warhmsGkjoqksXTfZU1kcKV0mBKTvDsRUBDnVTT/t1j2URIQDcn5Ja8ZyqZn2M3xgO9r BU0bURZ3qzQdF0VRkW4bBf0V6nqHLs9gR6g68R6aMzVO/dVhR9ByU/RWIG+hICgjcxB2 P55A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=PuCs27ON; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si1429418ejx.438.2019.10.04.01.26.55; Fri, 04 Oct 2019 01:27:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=PuCs27ON; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730803AbfJDHiQ (ORCPT + 99 others); Fri, 4 Oct 2019 03:38:16 -0400 Received: from zimbra2.kalray.eu ([92.103.151.219]:48294 "EHLO zimbra2.kalray.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730636AbfJDHiN (ORCPT ); Fri, 4 Oct 2019 03:38:13 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id DDA4A27E0F36; Fri, 4 Oct 2019 09:38:10 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id rl8GD9ew8mil; Fri, 4 Oct 2019 09:38:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 6454827E0E5F; Fri, 4 Oct 2019 09:38:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 6454827E0E5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1570174690; bh=m0IZGO1OMSmC0Bn/Pt54UKIFEBspEgEXw7Mo4uN0eac=; h=From:To:Date:Message-Id; b=PuCs27ONIu4SzkrjDdamr5UXsC416N7uxh+ro8SjzcPwY8Q0E35FroLBlNGfa24Y2 40hvcTd26Lu55u0dKJQQyDsrR5MjQDhdkYtkamfBjist8R+I+46RV+KSGg2gaI/mXz rCnUDqS5IBOZ3frv3wW6O7ReWPhV349FlOLH0FOE= X-Virus-Scanned: amavisd-new at zimbra2.kalray.eu Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id f-YyJ9MZVqKT; Fri, 4 Oct 2019 09:38:10 +0200 (CEST) Received: from triton.lin.mbt.kalray.eu (unknown [192.168.37.25]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 504D327E0E2E; Fri, 4 Oct 2019 09:38:10 +0200 (CEST) From: Clement Leger To: Ohad Ben-Cohen , Bjorn Andersson , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Clement Leger Subject: [PATCH] remoteproc: Fix wrong rvring index computation Date: Fri, 4 Oct 2019 09:37:36 +0200 Message-Id: <20191004073736.8327-1-cleger@kalray.eu> X-Mailer: git-send-email 2.15.0.276.g89ea799 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Index of rvring is computed using pointer arithmetic. However, since rvring->rvdev->vring is the base of the vring array, computation of rvring idx should be reversed. It previously lead to writing at negative indices in the resource table. Signed-off-by: Clement Leger --- drivers/remoteproc/remoteproc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 3c5fbbbfb0f1..ab7443874635 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -400,7 +400,7 @@ rproc_parse_vring(struct rproc_vdev *rvdev, struct fw_rsc_vdev *rsc, int i) void rproc_free_vring(struct rproc_vring *rvring) { struct rproc *rproc = rvring->rvdev->rproc; - int idx = rvring->rvdev->vring - rvring; + int idx = rvring - rvring->rvdev->vring; struct fw_rsc_vdev *rsc; idr_remove(&rproc->notifyids, rvring->notifyid); -- 2.15.0.276.g89ea799