From: Damien Lespiau Subject: Re: [PATCH] drm/i915: Fix possible overflow when recording semaphore states. Date: Fri, 18 Jul 2014 11:29:30 +0100 Message-ID: <20140718102930.GA31263@strange.amr.corp.intel.com> References: <1405600520-31173-1-git-send-email-rodrigo.vivi@intel.com> <20140717213114.GA3488@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 17B096E093 for ; Fri, 18 Jul 2014 03:29:33 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140717213114.GA3488@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Ben Widawsky Cc: intel-gfx@lists.freedesktop.org, Rodrigo Vivi List-Id: intel-gfx@lists.freedesktop.org On Thu, Jul 17, 2014 at 02:31:14PM -0700, Ben Widawsky wrote: > > - for_each_ring(useless, dev_priv, i) { > > + for_each_ring(to, dev_priv, i) { > > u16 signal_offset = > > (GEN8_SIGNAL_OFFSET(ring, i) & PAGE_MASK) / 4; > > u32 *tmp = error->semaphore_obj->pages[0]; > > + int idx = intel_ring_sync_index(ring, to); > > > > - ering->semaphore_mboxes[i] = tmp[signal_offset]; > > - ering->semaphore_seqno[i] = ring->semaphore.sync_seqno[i]; > > + ering->semaphore_mboxes[idx] = tmp[signal_offset]; > > + ering->semaphore_seqno[idx] = ring->semaphore.sync_seqno[idx]; > > } > > } > > > This patch looks correct to me. We're still looping over all the rings aren't we? we'll override the array when ring == to? -- Damien