dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: bskeggs@redhat.com
Cc: dri-devel@lists.freedesktop.org
Subject: re: drm/nouveau/fb: namespace + nvidia gpu names (no binary change)
Date: Mon, 18 May 2015 21:31:57 +0300	[thread overview]
Message-ID: <20150518183157.GA30343@mwanda> (raw)

Hello Ben Skeggs,

The patch 639c308effb9: "drm/nouveau/fb: namespace + nvidia gpu names
(no binary change)" from Jan 14, 2015, leads to the following static
checker warning:

	drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c:1297 gk104_ram_train_init()
	error: potential null dereference 'train'.  (kzalloc returns null)

drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
  1280  static int
  1281  gk104_ram_train_init(struct nvkm_fb *pfb)
  1282  {
  1283          u8 ramcfg = nvbios_ramcfg_index(nv_subdev(pfb));
  1284          struct gk104_ram_train *train;
  1285          int ret = -ENOMEM, i;
  1286  
  1287          if ((train = kzalloc(sizeof(*train), GFP_KERNEL))) {
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Assume the allocation fails.

  1288                  for (i = 0; i < 0x100; i++) {
  1289                          ret = gk104_ram_train_type(pfb, i, ramcfg, train);
  1290                          if (ret && ret != -ENOENT)
  1291                                  break;
  1292                  }
  1293          }
  1294  
  1295          switch (pfb->ram->type) {
  1296          case NV_MEM_TYPE_GDDR5:
  1297                  ret = gk104_ram_train_init_0(pfb, train);
                                                          ^^^^^
Dereferenced inside the gk104_ram_train_init_0() function.

  1298                  break;
  1299          default:
  1300                  ret = 0;
  1301                  break;
  1302          }
  1303  
  1304          kfree(train);
  1305          return ret;
  1306  }

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

                 reply	other threads:[~2015-05-18 18:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150518183157.GA30343@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox