From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v6] drm/ioctl: Add a ioctl to set and get a label on GEM objects
Date: Tue, 02 Jun 2020 13:23:30 +0300 [thread overview]
Message-ID: <20200602102330.GY30374@kadam> (raw)
In-Reply-To: <20200528170604.22476-1-rohan.garg@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 3345 bytes --]
Hi Rohan,
url: https://github.com/0day-ci/linux/commits/Rohan-Garg/drm-ioctl-Add-a-ioctl-to-set-and-get-a-label-on-GEM-objects/20200531-000134
base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
config: i386-randconfig-m021-20200531 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/gpu/drm/drm_gem.c:1004 drm_gem_get_label() warn: maybe return -EFAULT instead of the bytes remaining?
Old smatch warnings:
drivers/gpu/drm/drm_gem.c:910 drm_gem_open_ioctl() warn: inconsistent returns 'dev->object_name_lock'.
# https://github.com/0day-ci/linux/commit/174b10d2bdba06efe773aa0d09e682a57a00ec67
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 174b10d2bdba06efe773aa0d09e682a57a00ec67
vim +1004 drivers/gpu/drm/drm_gem.c
174b10d2bdba06 Rohan Garg 2020-05-28 979 int drm_gem_get_label(struct drm_device *dev, struct drm_file *file_priv,
174b10d2bdba06 Rohan Garg 2020-05-28 980 struct drm_handle_label *args)
174b10d2bdba06 Rohan Garg 2020-05-28 981 {
174b10d2bdba06 Rohan Garg 2020-05-28 982 struct drm_gem_object *gem_obj;
174b10d2bdba06 Rohan Garg 2020-05-28 983 int len, ret;
174b10d2bdba06 Rohan Garg 2020-05-28 984
174b10d2bdba06 Rohan Garg 2020-05-28 985 gem_obj = drm_gem_object_lookup(file_priv, args->handle);
174b10d2bdba06 Rohan Garg 2020-05-28 986 if (!gem_obj) {
174b10d2bdba06 Rohan Garg 2020-05-28 987 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle);
174b10d2bdba06 Rohan Garg 2020-05-28 988 return -ENOENT;
174b10d2bdba06 Rohan Garg 2020-05-28 989 }
174b10d2bdba06 Rohan Garg 2020-05-28 990
174b10d2bdba06 Rohan Garg 2020-05-28 991 if (!gem_obj->label) {
174b10d2bdba06 Rohan Garg 2020-05-28 992 args->label = NULL;
174b10d2bdba06 Rohan Garg 2020-05-28 993 args->len = 0;
174b10d2bdba06 Rohan Garg 2020-05-28 994 return 0;
174b10d2bdba06 Rohan Garg 2020-05-28 995 }
174b10d2bdba06 Rohan Garg 2020-05-28 996
174b10d2bdba06 Rohan Garg 2020-05-28 997 mutex_lock(&gem_obj->bo_lock);
174b10d2bdba06 Rohan Garg 2020-05-28 998 len = strlen(gem_obj->label);
174b10d2bdba06 Rohan Garg 2020-05-28 999 ret = copy_to_user(u64_to_user_ptr(args->label), gem_obj->label,
174b10d2bdba06 Rohan Garg 2020-05-28 1000 min(args->len, len));
copy_to_user() returns the number of bytes remaining to be copied but
this should be:
if (copy_to_user(u64_to_user_ptr(args->label), gem_obj->label,
min(args->len, len)))
ret = -EFAULT;
Don't forget to initialize "int ret = 0;" because GCC doesn't warn about
it these days... :/
174b10d2bdba06 Rohan Garg 2020-05-28 1001 mutex_unlock(&gem_obj->bo_lock);
174b10d2bdba06 Rohan Garg 2020-05-28 1002 args->len = len;
174b10d2bdba06 Rohan Garg 2020-05-28 1003 drm_gem_object_put(gem_obj);
174b10d2bdba06 Rohan Garg 2020-05-28 @1004 return ret;
174b10d2bdba06 Rohan Garg 2020-05-28 1005 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40684 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Rohan Garg <rohan.garg@collabora.com>,
dri-devel@lists.freedesktop.org
Cc: emil.l.velikov@gmail.com, kernel@collabora.com,
kbuild-all@lists.01.org, lkp@intel.com
Subject: Re: [PATCH v6] drm/ioctl: Add a ioctl to set and get a label on GEM objects
Date: Tue, 2 Jun 2020 13:23:30 +0300 [thread overview]
Message-ID: <20200602102330.GY30374@kadam> (raw)
In-Reply-To: <20200528170604.22476-1-rohan.garg@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 3278 bytes --]
Hi Rohan,
url: https://github.com/0day-ci/linux/commits/Rohan-Garg/drm-ioctl-Add-a-ioctl-to-set-and-get-a-label-on-GEM-objects/20200531-000134
base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
config: i386-randconfig-m021-20200531 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/gpu/drm/drm_gem.c:1004 drm_gem_get_label() warn: maybe return -EFAULT instead of the bytes remaining?
Old smatch warnings:
drivers/gpu/drm/drm_gem.c:910 drm_gem_open_ioctl() warn: inconsistent returns 'dev->object_name_lock'.
# https://github.com/0day-ci/linux/commit/174b10d2bdba06efe773aa0d09e682a57a00ec67
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 174b10d2bdba06efe773aa0d09e682a57a00ec67
vim +1004 drivers/gpu/drm/drm_gem.c
174b10d2bdba06 Rohan Garg 2020-05-28 979 int drm_gem_get_label(struct drm_device *dev, struct drm_file *file_priv,
174b10d2bdba06 Rohan Garg 2020-05-28 980 struct drm_handle_label *args)
174b10d2bdba06 Rohan Garg 2020-05-28 981 {
174b10d2bdba06 Rohan Garg 2020-05-28 982 struct drm_gem_object *gem_obj;
174b10d2bdba06 Rohan Garg 2020-05-28 983 int len, ret;
174b10d2bdba06 Rohan Garg 2020-05-28 984
174b10d2bdba06 Rohan Garg 2020-05-28 985 gem_obj = drm_gem_object_lookup(file_priv, args->handle);
174b10d2bdba06 Rohan Garg 2020-05-28 986 if (!gem_obj) {
174b10d2bdba06 Rohan Garg 2020-05-28 987 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle);
174b10d2bdba06 Rohan Garg 2020-05-28 988 return -ENOENT;
174b10d2bdba06 Rohan Garg 2020-05-28 989 }
174b10d2bdba06 Rohan Garg 2020-05-28 990
174b10d2bdba06 Rohan Garg 2020-05-28 991 if (!gem_obj->label) {
174b10d2bdba06 Rohan Garg 2020-05-28 992 args->label = NULL;
174b10d2bdba06 Rohan Garg 2020-05-28 993 args->len = 0;
174b10d2bdba06 Rohan Garg 2020-05-28 994 return 0;
174b10d2bdba06 Rohan Garg 2020-05-28 995 }
174b10d2bdba06 Rohan Garg 2020-05-28 996
174b10d2bdba06 Rohan Garg 2020-05-28 997 mutex_lock(&gem_obj->bo_lock);
174b10d2bdba06 Rohan Garg 2020-05-28 998 len = strlen(gem_obj->label);
174b10d2bdba06 Rohan Garg 2020-05-28 999 ret = copy_to_user(u64_to_user_ptr(args->label), gem_obj->label,
174b10d2bdba06 Rohan Garg 2020-05-28 1000 min(args->len, len));
copy_to_user() returns the number of bytes remaining to be copied but
this should be:
if (copy_to_user(u64_to_user_ptr(args->label), gem_obj->label,
min(args->len, len)))
ret = -EFAULT;
Don't forget to initialize "int ret = 0;" because GCC doesn't warn about
it these days... :/
174b10d2bdba06 Rohan Garg 2020-05-28 1001 mutex_unlock(&gem_obj->bo_lock);
174b10d2bdba06 Rohan Garg 2020-05-28 1002 args->len = len;
174b10d2bdba06 Rohan Garg 2020-05-28 1003 drm_gem_object_put(gem_obj);
174b10d2bdba06 Rohan Garg 2020-05-28 @1004 return ret;
174b10d2bdba06 Rohan Garg 2020-05-28 1005 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40684 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v6] drm/ioctl: Add a ioctl to set and get a label on GEM objects
Date: Tue, 02 Jun 2020 13:23:30 +0300 [thread overview]
Message-ID: <20200602102330.GY30374@kadam> (raw)
In-Reply-To: <20200528170604.22476-1-rohan.garg@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 3345 bytes --]
Hi Rohan,
url: https://github.com/0day-ci/linux/commits/Rohan-Garg/drm-ioctl-Add-a-ioctl-to-set-and-get-a-label-on-GEM-objects/20200531-000134
base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
config: i386-randconfig-m021-20200531 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/gpu/drm/drm_gem.c:1004 drm_gem_get_label() warn: maybe return -EFAULT instead of the bytes remaining?
Old smatch warnings:
drivers/gpu/drm/drm_gem.c:910 drm_gem_open_ioctl() warn: inconsistent returns 'dev->object_name_lock'.
# https://github.com/0day-ci/linux/commit/174b10d2bdba06efe773aa0d09e682a57a00ec67
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 174b10d2bdba06efe773aa0d09e682a57a00ec67
vim +1004 drivers/gpu/drm/drm_gem.c
174b10d2bdba06 Rohan Garg 2020-05-28 979 int drm_gem_get_label(struct drm_device *dev, struct drm_file *file_priv,
174b10d2bdba06 Rohan Garg 2020-05-28 980 struct drm_handle_label *args)
174b10d2bdba06 Rohan Garg 2020-05-28 981 {
174b10d2bdba06 Rohan Garg 2020-05-28 982 struct drm_gem_object *gem_obj;
174b10d2bdba06 Rohan Garg 2020-05-28 983 int len, ret;
174b10d2bdba06 Rohan Garg 2020-05-28 984
174b10d2bdba06 Rohan Garg 2020-05-28 985 gem_obj = drm_gem_object_lookup(file_priv, args->handle);
174b10d2bdba06 Rohan Garg 2020-05-28 986 if (!gem_obj) {
174b10d2bdba06 Rohan Garg 2020-05-28 987 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle);
174b10d2bdba06 Rohan Garg 2020-05-28 988 return -ENOENT;
174b10d2bdba06 Rohan Garg 2020-05-28 989 }
174b10d2bdba06 Rohan Garg 2020-05-28 990
174b10d2bdba06 Rohan Garg 2020-05-28 991 if (!gem_obj->label) {
174b10d2bdba06 Rohan Garg 2020-05-28 992 args->label = NULL;
174b10d2bdba06 Rohan Garg 2020-05-28 993 args->len = 0;
174b10d2bdba06 Rohan Garg 2020-05-28 994 return 0;
174b10d2bdba06 Rohan Garg 2020-05-28 995 }
174b10d2bdba06 Rohan Garg 2020-05-28 996
174b10d2bdba06 Rohan Garg 2020-05-28 997 mutex_lock(&gem_obj->bo_lock);
174b10d2bdba06 Rohan Garg 2020-05-28 998 len = strlen(gem_obj->label);
174b10d2bdba06 Rohan Garg 2020-05-28 999 ret = copy_to_user(u64_to_user_ptr(args->label), gem_obj->label,
174b10d2bdba06 Rohan Garg 2020-05-28 1000 min(args->len, len));
copy_to_user() returns the number of bytes remaining to be copied but
this should be:
if (copy_to_user(u64_to_user_ptr(args->label), gem_obj->label,
min(args->len, len)))
ret = -EFAULT;
Don't forget to initialize "int ret = 0;" because GCC doesn't warn about
it these days... :/
174b10d2bdba06 Rohan Garg 2020-05-28 1001 mutex_unlock(&gem_obj->bo_lock);
174b10d2bdba06 Rohan Garg 2020-05-28 1002 args->len = len;
174b10d2bdba06 Rohan Garg 2020-05-28 1003 drm_gem_object_put(gem_obj);
174b10d2bdba06 Rohan Garg 2020-05-28 @1004 return ret;
174b10d2bdba06 Rohan Garg 2020-05-28 1005 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40684 bytes --]
next prev parent reply other threads:[~2020-06-02 10:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 17:06 [PATCH v6] drm/ioctl: Add a ioctl to set and get a label on GEM objects Rohan Garg
2020-05-28 18:45 ` Eric Anholt
2020-05-29 13:44 ` Rohan Garg
2020-05-29 17:10 ` Eric Anholt
2020-06-09 14:15 ` Rohan Garg
2020-05-30 18:16 ` kbuild test robot
2020-05-30 18:16 ` kbuild test robot
2020-05-31 1:56 ` kbuild test robot
2020-05-31 1:56 ` kbuild test robot
2020-05-31 3:03 ` kbuild test robot
2020-05-31 3:03 ` kbuild test robot
2020-06-02 10:23 ` Dan Carpenter [this message]
2020-06-02 10:23 ` Dan Carpenter
2020-06-02 10:23 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-05-31 7:39 kbuild test robot
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=20200602102330.GY30374@kadam \
--to=dan.carpenter@oracle.com \
--cc=kbuild@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.