Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp Make...



details:   https://anonhg.NetBSD.org/src/rev/d3a920292229
branches:  trunk
changeset: 344835:d3a920292229
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 23 14:59:01 2016 +0000

description:
Make it clearer to Coverity that there's no array overrun.

CID 989067

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r e7036d376120 -r d3a920292229 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c        Sat Apr 23 14:48:45 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c        Sat Apr 23 14:59:01 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_engine_disp_nvd0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $   */
+/*     $NetBSD: nouveau_engine_disp_nvd0.c,v 1.3 2016/04/23 14:59:01 riastradh Exp $   */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nvd0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nvd0.c,v 1.3 2016/04/23 14:59:01 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/parent.h>
@@ -1042,7 +1042,8 @@
        }
 
        data = nvbios_ocfg_match(bios, data, conf, &ver, &hdr, &cnt, &len, &info2);
-       if (data && id < 0xff) {
+       CTASSERT(__arraycount(info2.clkcmp) <= 0xff);
+       if (data && id < __arraycount(info2.clkcmp)) {
                data = nvbios_oclk_match(bios, info2.clkcmp[id], pclk);
                if (data) {
                        struct nvbios_init init = {



Home | Main Index | Thread Index | Old Index