mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Lyude Paul <lyude@redhat.com>
Cc: kbuild-all@01.org, nouveau@lists.freedesktop.org,
	David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org,
	Karol Herbst <karolherbst@gmail.com>,
	dri-devel@lists.freedesktop.org, Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [PATCH] drm/nouveau: Fix potential memory access error in nouveau_debugfs_pstate_get()
Date: Wed, 1 Aug 2018 17:13:14 +0800	[thread overview]
Message-ID: <201808011717.HBBoh9vc%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180731010347.21921-1-lyude@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 5918 bytes --]

Hi Lyude,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.18-rc7 next-20180731]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Lyude-Paul/drm-nouveau-Fix-potential-memory-access-error-in-nouveau_debugfs_pstate_get/20180801-155246
config: i386-randconfig-a1-201830 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/gpu//drm/nouveau/nouveau_debugfs.c: In function 'nouveau_debugfs_pstate_get':
>> drivers/gpu//drm/nouveau/nouveau_debugfs.c:54:22: warning: 'debugfs' is used uninitialized in this function [-Wuninitialized]
     struct nvif_object *ctrl = &debugfs->ctrl;
                         ^

vim +/debugfs +54 drivers/gpu//drm/nouveau/nouveau_debugfs.c

33b903e8 Marcin Slusarz 2013-02-08   48  
6e9fc177 Karol Herbst   2015-07-30   49  static int
6e9fc177 Karol Herbst   2015-07-30   50  nouveau_debugfs_pstate_get(struct seq_file *m, void *data)
6e9fc177 Karol Herbst   2015-07-30   51  {
1a54082a Noralf Trønnes 2017-01-26   52  	struct drm_device *drm = m->private;
11a2501e Lyude Paul     2018-07-30   53  	struct nouveau_debugfs *debugfs;
6e9fc177 Karol Herbst   2015-07-30  @54  	struct nvif_object *ctrl = &debugfs->ctrl;
6e9fc177 Karol Herbst   2015-07-30   55  	struct nvif_control_pstate_info_v0 info = {};
6e9fc177 Karol Herbst   2015-07-30   56  	int ret, i;
6e9fc177 Karol Herbst   2015-07-30   57  
11a2501e Lyude Paul     2018-07-30   58  	if (!drm)
6e9fc177 Karol Herbst   2015-07-30   59  		return -ENODEV;
11a2501e Lyude Paul     2018-07-30   60  	debugfs = nouveau_debugfs(drm);
6e9fc177 Karol Herbst   2015-07-30   61  
6e9fc177 Karol Herbst   2015-07-30   62  	ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_INFO, &info, sizeof(info));
6e9fc177 Karol Herbst   2015-07-30   63  	if (ret)
6e9fc177 Karol Herbst   2015-07-30   64  		return ret;
6e9fc177 Karol Herbst   2015-07-30   65  
6e9fc177 Karol Herbst   2015-07-30   66  	for (i = 0; i < info.count + 1; i++) {
6e9fc177 Karol Herbst   2015-07-30   67  		const s32 state = i < info.count ? i :
6e9fc177 Karol Herbst   2015-07-30   68  			NVIF_CONTROL_PSTATE_ATTR_V0_STATE_CURRENT;
6e9fc177 Karol Herbst   2015-07-30   69  		struct nvif_control_pstate_attr_v0 attr = {
6e9fc177 Karol Herbst   2015-07-30   70  			.state = state,
6e9fc177 Karol Herbst   2015-07-30   71  			.index = 0,
6e9fc177 Karol Herbst   2015-07-30   72  		};
6e9fc177 Karol Herbst   2015-07-30   73  
6e9fc177 Karol Herbst   2015-07-30   74  		ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_ATTR,
6e9fc177 Karol Herbst   2015-07-30   75  				&attr, sizeof(attr));
6e9fc177 Karol Herbst   2015-07-30   76  		if (ret)
6e9fc177 Karol Herbst   2015-07-30   77  			return ret;
6e9fc177 Karol Herbst   2015-07-30   78  
6e9fc177 Karol Herbst   2015-07-30   79  		if (i < info.count)
6e9fc177 Karol Herbst   2015-07-30   80  			seq_printf(m, "%02x:", attr.state);
6e9fc177 Karol Herbst   2015-07-30   81  		else
6e9fc177 Karol Herbst   2015-07-30   82  			seq_printf(m, "%s:", info.pwrsrc == 0 ? "DC" :
6e9fc177 Karol Herbst   2015-07-30   83  					     info.pwrsrc == 1 ? "AC" : "--");
6e9fc177 Karol Herbst   2015-07-30   84  
6e9fc177 Karol Herbst   2015-07-30   85  		attr.index = 0;
6e9fc177 Karol Herbst   2015-07-30   86  		do {
6e9fc177 Karol Herbst   2015-07-30   87  			attr.state = state;
6e9fc177 Karol Herbst   2015-07-30   88  			ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_ATTR,
6e9fc177 Karol Herbst   2015-07-30   89  					&attr, sizeof(attr));
6e9fc177 Karol Herbst   2015-07-30   90  			if (ret)
6e9fc177 Karol Herbst   2015-07-30   91  				return ret;
6e9fc177 Karol Herbst   2015-07-30   92  
6e9fc177 Karol Herbst   2015-07-30   93  			seq_printf(m, " %s %d", attr.name, attr.min);
6e9fc177 Karol Herbst   2015-07-30   94  			if (attr.min != attr.max)
6e9fc177 Karol Herbst   2015-07-30   95  				seq_printf(m, "-%d", attr.max);
6e9fc177 Karol Herbst   2015-07-30   96  			seq_printf(m, " %s", attr.unit);
6e9fc177 Karol Herbst   2015-07-30   97  		} while (attr.index);
6e9fc177 Karol Herbst   2015-07-30   98  
6e9fc177 Karol Herbst   2015-07-30   99  		if (state >= 0) {
6e9fc177 Karol Herbst   2015-07-30  100  			if (info.ustate_ac == state)
6e9fc177 Karol Herbst   2015-07-30  101  				seq_printf(m, " AC");
6e9fc177 Karol Herbst   2015-07-30  102  			if (info.ustate_dc == state)
6e9fc177 Karol Herbst   2015-07-30  103  				seq_printf(m, " DC");
6e9fc177 Karol Herbst   2015-07-30  104  			if (info.pstate == state)
6e9fc177 Karol Herbst   2015-07-30  105  				seq_printf(m, " *");
6e9fc177 Karol Herbst   2015-07-30  106  		} else {
6e9fc177 Karol Herbst   2015-07-30  107  			if (info.ustate_ac < -1)
6e9fc177 Karol Herbst   2015-07-30  108  				seq_printf(m, " AC");
6e9fc177 Karol Herbst   2015-07-30  109  			if (info.ustate_dc < -1)
6e9fc177 Karol Herbst   2015-07-30  110  				seq_printf(m, " DC");
6e9fc177 Karol Herbst   2015-07-30  111  		}
6e9fc177 Karol Herbst   2015-07-30  112  
6e9fc177 Karol Herbst   2015-07-30  113  		seq_printf(m, "\n");
6e9fc177 Karol Herbst   2015-07-30  114  	}
6e9fc177 Karol Herbst   2015-07-30  115  
6e9fc177 Karol Herbst   2015-07-30  116  	return 0;
6e9fc177 Karol Herbst   2015-07-30  117  }
6e9fc177 Karol Herbst   2015-07-30  118  

:::::: The code at line 54 was first introduced by commit
:::::: 6e9fc177399f08446293fec7607913fdbc95e191 drm/nouveau/debugfs: add copy of sysfs pstate interface ported to debugfs

:::::: TO: Karol Herbst <nouveau@karolherbst.de>
:::::: CC: Ben Skeggs <bskeggs@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29403 bytes --]

      reply	other threads:[~2018-08-01  9:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  1:03 Lyude Paul
2018-08-01  9:13 ` kbuild test robot [this message]

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=201808011717.HBBoh9vc%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karolherbst@gmail.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@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

all inboxes | Powered by JetHome®