From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [pinchartl-media:media/drm/dpsub/next 5/14] drivers/dma/xilinx/xilinx_dpdma.c:389 xilinx_dpdma_debugfs_read() warn: maybe return -EFAULT instead of the bytes remaining?
Date: Thu, 12 Mar 2020 06:56:42 -0700 [thread overview]
Message-ID: <20200312135642.GL11561@kadam> (raw)
[-- Attachment #1: Type: text/plain, Size: 3580 bytes --]
tree: git://linuxtv.org/pinchartl/media.git media/drm/dpsub/next
head: fc1d178201c64a7b0106f84de5503eead44c0586
commit: efaa5ceddb7bdb19307a215e8ec207ded1c87474 [5/14] dmaengine: xilinx: dpdma: Add debugfs support
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/dma/xilinx/xilinx_dpdma.c:389 xilinx_dpdma_debugfs_read() warn: maybe return -EFAULT instead of the bytes remaining?
git remote add pinchartl-media git://linuxtv.org/pinchartl/media.git
git remote update pinchartl-media
git checkout efaa5ceddb7bdb19307a215e8ec207ded1c87474
vim +389 drivers/dma/xilinx/xilinx_dpdma.c
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 357 static ssize_t xilinx_dpdma_debugfs_read(struct file *f, char __user *buf,
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 358 size_t size, loff_t *pos)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 359 {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 360 enum xilinx_dpdma_testcases testcase;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 361 char *kern_buff;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 362 int ret;
ret = 0;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 363
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 364 if (*pos != 0 || size <= 0)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 365 return -EINVAL;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 366
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 367 kern_buff = kzalloc(XILINX_DPDMA_DEBUGFS_READ_MAX_SIZE, GFP_KERNEL);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 368 if (!kern_buff) {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 369 dpdma_debugfs.testcase = DPDMA_TC_NONE;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 370 return -ENOMEM;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 371 }
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 372
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 373 testcase = READ_ONCE(dpdma_debugfs.testcase);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 374 if (testcase != DPDMA_TC_NONE) {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 375 ret = dpdma_debugfs_reqs[testcase].read(kern_buff);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 376 if (ret < 0)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 377 goto done;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 378 } else {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 379 strlcpy(kern_buff, "No testcase executed",
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 380 XILINX_DPDMA_DEBUGFS_READ_MAX_SIZE);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 381 }
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 382
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 383 size = min(size, strlen(kern_buff));
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 384 ret = copy_to_user(buf, kern_buff, size);
if (copy_to_user(buf, kern_buff, size))
ret = -EFAULT;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 385
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 386 done:
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 387 kfree(kern_buff);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 388 if (ret)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 @389 return ret;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 390
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 391 *pos = size + 1;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 392 return size;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 393 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [pinchartl-media:media/drm/dpsub/next 5/14] drivers/dma/xilinx/xilinx_dpdma.c:389 xilinx_dpdma_debugfs_read() warn: maybe return -EFAULT instead of the bytes remaining?
Date: Thu, 12 Mar 2020 06:56:42 -0700 [thread overview]
Message-ID: <20200312135642.GL11561@kadam> (raw)
[-- Attachment #1: Type: text/plain, Size: 3580 bytes --]
tree: git://linuxtv.org/pinchartl/media.git media/drm/dpsub/next
head: fc1d178201c64a7b0106f84de5503eead44c0586
commit: efaa5ceddb7bdb19307a215e8ec207ded1c87474 [5/14] dmaengine: xilinx: dpdma: Add debugfs support
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/dma/xilinx/xilinx_dpdma.c:389 xilinx_dpdma_debugfs_read() warn: maybe return -EFAULT instead of the bytes remaining?
git remote add pinchartl-media git://linuxtv.org/pinchartl/media.git
git remote update pinchartl-media
git checkout efaa5ceddb7bdb19307a215e8ec207ded1c87474
vim +389 drivers/dma/xilinx/xilinx_dpdma.c
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 357 static ssize_t xilinx_dpdma_debugfs_read(struct file *f, char __user *buf,
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 358 size_t size, loff_t *pos)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 359 {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 360 enum xilinx_dpdma_testcases testcase;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 361 char *kern_buff;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 362 int ret;
ret = 0;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 363
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 364 if (*pos != 0 || size <= 0)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 365 return -EINVAL;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 366
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 367 kern_buff = kzalloc(XILINX_DPDMA_DEBUGFS_READ_MAX_SIZE, GFP_KERNEL);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 368 if (!kern_buff) {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 369 dpdma_debugfs.testcase = DPDMA_TC_NONE;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 370 return -ENOMEM;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 371 }
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 372
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 373 testcase = READ_ONCE(dpdma_debugfs.testcase);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 374 if (testcase != DPDMA_TC_NONE) {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 375 ret = dpdma_debugfs_reqs[testcase].read(kern_buff);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 376 if (ret < 0)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 377 goto done;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 378 } else {
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 379 strlcpy(kern_buff, "No testcase executed",
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 380 XILINX_DPDMA_DEBUGFS_READ_MAX_SIZE);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 381 }
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 382
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 383 size = min(size, strlen(kern_buff));
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 384 ret = copy_to_user(buf, kern_buff, size);
if (copy_to_user(buf, kern_buff, size))
ret = -EFAULT;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 385
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 386 done:
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 387 kfree(kern_buff);
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 388 if (ret)
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 @389 return ret;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 390
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 391 *pos = size + 1;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 392 return size;
efaa5ceddb7bdb Laurent Pinchart 2019-11-07 393 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next reply other threads:[~2020-03-12 13:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 13:56 Dan Carpenter [this message]
2020-03-12 13:56 ` [pinchartl-media:media/drm/dpsub/next 5/14] drivers/dma/xilinx/xilinx_dpdma.c:389 xilinx_dpdma_debugfs_read() warn: maybe return -EFAULT instead of the bytes remaining? Dan Carpenter
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=20200312135642.GL11561@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.