Received: from eggs.gnu.org ([208.118.235.92]:47405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9uEH-0000WT-Rd for qemu-devel@nongnu.org; Fri, 07 Sep 2012 04:48:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9uEC-0004ds-4J for qemu-devel@nongnu.org; Fri, 07 Sep 2012 04:47:57 -0400 Received: from mail-lpp01m010-f45.google.com ([209.85.215.45]:45730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9uEB-0004dn-Sw for qemu-devel@nongnu.org; Fri, 07 Sep 2012 04:47:52 -0400 Received: by lagz14 with SMTP id z14so1537377lag.4 for ; Fri, 07 Sep 2012 01:47:50 -0700 (PDT) Date: Fri, 7 Sep 2012 10:47:48 +0200 From: "Edgar E. Iglesias" Message-ID: <20120907084748.GB23158@edde.se.axis.com> References: <1346737552-2390-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1346737552-2390-1-git-send-email-sw@weilnetz.de> Subject: Re: [Qemu-devel] [PATCH] target-cris: Fix buffer overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: qemu-devel@nongnu.org On Tue, Sep 04, 2012 at 07:45:52AM +0200, Stefan Weil wrote: > Report from smatch: > > target-cris/translate.c:3464 cpu_dump_state(32) error: > buffer overflow 'env->sregs' 4 <= 255 > > sregs is declared 'uint32_t sregs[4][16]', so the first index must be > less than 4. Hi Stefan, I think it would be better to use ARRAY_SIZE(env->sregs) instead of 4. The cris arch allows up to 256 sregs, but we only implement 4 at the moment. There are other uses of hardcoded 4 in the code that could be fixed aswell if you have time. Thanks, Edgar