Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
by kernel test robot
Hi Nick,
I love your patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on linus/master v5.10-rc4 next-20201116]
[cannot apply to pmladek/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nick-Desaulniers/PPC-Fix-Wimplic...
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: x86_64-randconfig-m001-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
smatch warnings:
lib/zstd/huf_compress.c:559 HUF_compress1X_usingCTable() warn: inconsistent indenting
vim +559 lib/zstd/huf_compress.c
529
530 #define HUF_FLUSHBITS_1(stream) \
531 if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 2 + 7) \
532 HUF_FLUSHBITS(stream)
533
534 #define HUF_FLUSHBITS_2(stream) \
535 if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 4 + 7) \
536 HUF_FLUSHBITS(stream)
537
538 size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, size_t srcSize, const HUF_CElt *CTable)
539 {
540 const BYTE *ip = (const BYTE *)src;
541 BYTE *const ostart = (BYTE *)dst;
542 BYTE *const oend = ostart + dstSize;
543 BYTE *op = ostart;
544 size_t n;
545 BIT_CStream_t bitC;
546
547 /* init */
548 if (dstSize < 8)
549 return 0; /* not enough space to compress */
550 {
551 size_t const initErr = BIT_initCStream(&bitC, op, oend - op);
552 if (HUF_isError(initErr))
553 return 0;
554 }
555
556 n = srcSize & ~3; /* join to mod 4 */
557 switch (srcSize & 3) {
558 case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> 559 fallthrough;
560 case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
561 fallthrough;
562 case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
563 case 0:
564 default:;
565 }
566
567 for (; n > 0; n -= 4) { /* note : n&3==0 at this stage */
568 HUF_encodeSymbol(&bitC, ip[n - 1], CTable);
569 HUF_FLUSHBITS_1(&bitC);
570 HUF_encodeSymbol(&bitC, ip[n - 2], CTable);
571 HUF_FLUSHBITS_2(&bitC);
572 HUF_encodeSymbol(&bitC, ip[n - 3], CTable);
573 HUF_FLUSHBITS_1(&bitC);
574 HUF_encodeSymbol(&bitC, ip[n - 4], CTable);
575 HUF_FLUSHBITS(&bitC);
576 }
577
578 return BIT_closeCStream(&bitC);
579 }
580
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months
Re: drivers/gpu/drm/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() error: double locked 'ctx->engines_mutex' (orig line 59)
by Dan Carpenter
On Mon, Nov 16, 2020 at 10:15:04AM +0000, Chris Wilson wrote:
> Quoting Dan Carpenter (2020-11-16 10:08:38)
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 0062442ecfef0d82cd69e3e600d5006357f8d8e4
> > commit: 27a5dcfe73f4b696b3de8c23a560199bb1c193a4 drm/i915/gem: Remove disordered per-file request list for throttling
> > config: i386-randconfig-m021-20201115 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp(a)intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
> >
> > smatch warnings:
> > drivers/gpu/drm/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() error: double locked 'ctx->engines_mutex' (orig line 59)
> >
> > vim +59 drivers/gpu/drm/i915/gem/i915_gem_throttle.c
> >
> > 35 int
> > 36 i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
> > 37 struct drm_file *file)
> > 38 {
> > 39 const unsigned long recent_enough = jiffies - DRM_I915_THROTTLE_JIFFIES;
> > 40 struct drm_i915_file_private *file_priv = file->driver_priv;
> > 41 struct i915_gem_context *ctx;
> > 42 unsigned long idx;
> > 43 long ret;
> > 44
> > 45 /* ABI: return -EIO if already wedged */
> > 46 ret = intel_gt_terminally_wedged(&to_i915(dev)->gt);
> > 47 if (ret)
> > 48 return ret;
> > 49
> > 50 rcu_read_lock();
> > 51 xa_for_each(&file_priv->context_xa, idx, ctx) {
> > 52 struct i915_gem_engines_iter it;
> > 53 struct intel_context *ce;
> > 54
> > 55 if (!kref_get_unless_zero(&ctx->ref))
> > 56 continue;
> > 57 rcu_read_unlock();
> > 58
> > 59 for_each_gem_engine(ce,
> > 60 i915_gem_context_lock_engines(ctx),
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > I don't understand why this takes the lock every iteration through the
> > loop
>
> It doesn't.
>
> static inline struct i915_gem_engines *
> i915_gem_context_lock_engines(struct i915_gem_context *ctx)
> __acquires(&ctx->engines_mutex)
> {
> mutex_lock(&ctx->engines_mutex);
> return i915_gem_context_engines(ctx);
> }
>
> static inline void
> i915_gem_context_unlock_engines(struct i915_gem_context *ctx)
> __releases(&ctx->engines_mutex)
> {
> mutex_unlock(&ctx->engines_mutex);
> }
>
> with the i915_gem_engines stored as a local in the iterator at the start
> of the for loop.
Yeah... But that's true enough. But what I think is actually causing
the static checker warning are the continues.
52 xa_for_each(&file_priv->context_xa, idx, ctx) {
53 struct i915_gem_engines_iter it;
54 struct intel_context *ce;
55
56 if (!kref_get_unless_zero(&ctx->ref))
57 continue;
58 rcu_read_unlock();
59
60 for_each_gem_engine(ce,
61 i915_gem_context_lock_engines(ctx),
62 it) {
63 struct i915_request *rq, *target = NULL;
64
65 if (!ce->timeline)
66 continue;
^^^^^^^^^
This continue is for the inside loop, so "ctx" isn't iterated. There
is another continue as well later in the loop. Potentially they could
be replaced with breaks?
67
68 mutex_lock(&ce->timeline->mutex);
69 list_for_each_entry_reverse(rq,
70 &ce->timeline->requests,
71 link) {
72 if (i915_request_completed(rq))
regards,
dan carpenter
1 year, 10 months
drivers/gpu/drm/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() error: double locked 'ctx->engines_mutex' (orig line 59)
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0062442ecfef0d82cd69e3e600d5006357f8d8e4
commit: 27a5dcfe73f4b696b3de8c23a560199bb1c193a4 drm/i915/gem: Remove disordered per-file request list for throttling
config: i386-randconfig-m021-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/gpu/drm/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() error: double locked 'ctx->engines_mutex' (orig line 59)
vim +59 drivers/gpu/drm/i915/gem/i915_gem_throttle.c
35 int
36 i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
37 struct drm_file *file)
38 {
39 const unsigned long recent_enough = jiffies - DRM_I915_THROTTLE_JIFFIES;
40 struct drm_i915_file_private *file_priv = file->driver_priv;
41 struct i915_gem_context *ctx;
42 unsigned long idx;
43 long ret;
44
45 /* ABI: return -EIO if already wedged */
46 ret = intel_gt_terminally_wedged(&to_i915(dev)->gt);
47 if (ret)
48 return ret;
49
50 rcu_read_lock();
51 xa_for_each(&file_priv->context_xa, idx, ctx) {
52 struct i915_gem_engines_iter it;
53 struct intel_context *ce;
54
55 if (!kref_get_unless_zero(&ctx->ref))
56 continue;
57 rcu_read_unlock();
58
59 for_each_gem_engine(ce,
60 i915_gem_context_lock_engines(ctx),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I don't understand why this takes the lock every iteration through the
loop
61 it) {
62 struct i915_request *rq, *target = NULL;
63
64 if (!ce->timeline)
65 continue;
66
67 mutex_lock(&ce->timeline->mutex);
68 list_for_each_entry_reverse(rq,
69 &ce->timeline->requests,
70 link) {
71 if (i915_request_completed(rq))
72 break;
73
74 if (time_after(rq->emitted_jiffies,
75 recent_enough))
76 continue;
77
78 target = i915_request_get(rq);
79 break;
80 }
81 mutex_unlock(&ce->timeline->mutex);
82 if (!target)
83 continue;
84
85 ret = i915_request_wait(target,
86 I915_WAIT_INTERRUPTIBLE,
87 MAX_SCHEDULE_TIMEOUT);
88 i915_request_put(target);
89 if (ret < 0)
90 break;
91 }
92 i915_gem_context_unlock_engines(ctx);
But only unlocks the last element
93 i915_gem_context_put(ctx);
94
95 rcu_read_lock();
96 }
97 rcu_read_unlock();
98
99 return ret < 0 ? ret : 0;
100 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months
[hch-block:bdev-inode 71/72] block/partitions/core.c:417 add_partition() warn: passing zero to 'ERR_PTR'
by Dan Carpenter
tree: git://git.infradead.org/users/hch/block.git bdev-inode
head: aa9426788d1aeb32c20dfd1e0181a42a8dd0890d
commit: 884bbcdbaaf8439db16bcf64ec891dcc62d172ea [71/72] block: merge struct block_device and struct hd_struct
config: x86_64-randconfig-m001-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
block/partitions/core.c:417 add_partition() warn: passing zero to 'ERR_PTR'
vim +/ERR_PTR +417 block/partitions/core.c
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 313 static struct block_device *add_partition(struct gendisk *disk, int partno,
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 314 sector_t start, sector_t len, int flags,
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 315 struct partition_meta_info *info)
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 316 {
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 317 struct block_device *p;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 318 dev_t devt = MKDEV(0, 0);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 319 struct device *ddev = disk_to_dev(disk);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 320 struct device *pdev;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 321 struct disk_part_tbl *ptbl;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 322 const char *dname;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 323 int err;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 324
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 325 /*
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 326 * Partitions are not supported on zoned block devices that are used as
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 327 * such.
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 328 */
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 329 switch (disk->queue->limits.zoned) {
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 330 case BLK_ZONED_HM:
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 331 pr_warn("%s: partitions not supported on host managed zoned block device\n",
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 332 disk->disk_name);
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 333 return ERR_PTR(-ENXIO);
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 334 case BLK_ZONED_HA:
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 335 pr_info("%s: disabling host aware zoned block device support due to partitions\n",
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 336 disk->disk_name);
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 337 disk->queue->limits.zoned = BLK_ZONED_NONE;
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 338 break;
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 339 case BLK_ZONED_NONE:
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 340 break;
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 341 }
b72053072c0bbe block/partition-generic.c Christoph Hellwig 2020-01-26 342
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 343 err = disk_expand_part_tbl(disk, partno);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 344 if (err)
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 345 return ERR_PTR(err);
6d2cf6f2b446c4 block/partition-generic.c Bart Van Assche 2017-08-17 346 ptbl = rcu_dereference_protected(disk->part_tbl, 1);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 347
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 348 if (ptbl->part[partno])
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 349 return ERR_PTR(-EBUSY);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 350
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 351 p = bdev_alloc(disk, partno);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 352 if (!p)
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 353 return ERR_PTR(-ENOMEM);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 354
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 355 p->bd_start_sect = start;
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 356 bdev_set_nr_sectors(p, len);
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 357 p->bd_policy = get_disk_ro(disk);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 358
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 359 if (info) {
f17c21c1ecb80e block/partition-generic.c Christoph Hellwig 2020-03-24 360 struct partition_meta_info *pinfo;
f17c21c1ecb80e block/partition-generic.c Christoph Hellwig 2020-03-24 361
f17c21c1ecb80e block/partition-generic.c Christoph Hellwig 2020-03-24 362 pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id);
010459fd9ad527 block/partitions/core.c Christoph Hellwig 2020-08-31 363 if (!pinfo)
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 364 goto out_free_stats;
missing "err = -ENOMEM;"
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 365 memcpy(pinfo, info, sizeof(*info));
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 366 p->bd_meta_info = pinfo;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 367 }
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 368
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 369 pdev = part_to_dev(p);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 370 dname = dev_name(ddev);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 371 if (isdigit(dname[strlen(dname) - 1]))
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 372 dev_set_name(pdev, "%sp%d", dname, partno);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 373 else
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 374 dev_set_name(pdev, "%s%d", dname, partno);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 375
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 376 device_initialize(pdev);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 377 pdev->class = &block_class;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 378 pdev->type = &part_type;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 379 pdev->parent = ddev;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 380
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 381 err = blk_alloc_devt(p, &devt);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 382 if (err)
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 383 goto out_free_info;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 384 pdev->devt = devt;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 385
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 386 /* delay uevent until 'holders' subdir is created */
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 387 dev_set_uevent_suppress(pdev, 1);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 388 err = device_add(pdev);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 389 if (err)
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 390 goto out_put;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 391
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 392 err = -ENOMEM;
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 393 p->bd_holder_dir = kobject_create_and_add("holders", &pdev->kobj);
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 394 if (!p->bd_holder_dir)
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 395 goto out_del;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 396
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 397 dev_set_uevent_suppress(pdev, 0);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 398 if (flags & ADDPART_FLAG_WHOLEDISK) {
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 399 err = device_create_file(pdev, &dev_attr_whole_disk);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 400 if (err)
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 401 goto out_del;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 402 }
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 403
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 404 /* everything is up and running, commence */
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 405 bdev_add(p, devt);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 406 rcu_assign_pointer(ptbl->part[partno], p);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 407
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 408 /* suppress uevent if the disk suppresses it */
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 409 if (!dev_get_uevent_suppress(ddev))
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 410 kobject_uevent(&pdev->kobj, KOBJ_ADD);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 411 return p;
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 412
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 413 out_free_info:
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 414 kfree(p->bd_meta_info);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 415 out_free_stats:
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 416 bdput(p);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 @417 return ERR_PTR(err);
010459fd9ad527 block/partitions/core.c Christoph Hellwig 2020-08-31 418
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 419 out_del:
884bbcdbaaf843 block/partitions/core.c Christoph Hellwig 2020-11-14 420 kobject_put(p->bd_holder_dir);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 421 device_del(pdev);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 422 out_put:
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 423 put_device(pdev);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 424 return ERR_PTR(err);
94ea4158f1733e block/partition-generic.c Al Viro 2011-09-16 425 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months
[linux-review:UPDATE-20201116-151039/Yu-Kuai/clocksource-drivers-cadence_ttc-fix-memory-leak-in-ttc_setup_clockevent/20201110-091242 1/1] drivers/clocksource/timer-cadence-ttc.c:417:3: error: 'go' undeclared
by kernel test robot
tree: https://github.com/0day-ci/linux/commits/UPDATE-20201116-151039/Yu-Kuai/c...
head: 05b62d74281ba2bacf59b6d023dddbdb019ed280
commit: 05b62d74281ba2bacf59b6d023dddbdb019ed280 [1/1] clocksource/drivers/cadence_ttc: fix memory leak in ttc_setup_clockevent()
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/05b62d74281ba2bacf59b6d023dddbdb0...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20201116-151039/Yu-Kuai/clocksource-drivers-cadence_ttc-fix-memory-leak-in-ttc_setup_clockevent/20201110-091242
git checkout 05b62d74281ba2bacf59b6d023dddbdb019ed280
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/clocksource/timer-cadence-ttc.c: In function 'ttc_setup_clockevent':
>> drivers/clocksource/timer-cadence-ttc.c:417:3: error: 'go' undeclared (first use in this function)
417 | go out_kfree;
| ^~
drivers/clocksource/timer-cadence-ttc.c:417:3: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/clocksource/timer-cadence-ttc.c:417:5: error: expected ';' before 'out_kfree'
417 | go out_kfree;
| ^~~~~~~~~~
| ;
vim +/go +417 drivers/clocksource/timer-cadence-ttc.c
402
403 static int __init ttc_setup_clockevent(struct clk *clk,
404 void __iomem *base, u32 irq)
405 {
406 struct ttc_timer_clockevent *ttcce;
407 int err;
408
409 ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL);
410 if (!ttcce)
411 return -ENOMEM;
412
413 ttcce->ttc.clk = clk;
414
415 err = clk_prepare_enable(ttcce->ttc.clk);
416 if (err)
> 417 go out_kfree;
418
419 ttcce->ttc.clk_rate_change_nb.notifier_call =
420 ttc_rate_change_clockevent_cb;
421 ttcce->ttc.clk_rate_change_nb.next = NULL;
422
423 err = clk_notifier_register(ttcce->ttc.clk,
424 &ttcce->ttc.clk_rate_change_nb);
425 if (err) {
426 pr_warn("Unable to register clock notifier.\n");
427 goto out_kfree;
428 }
429
430 ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
431
432 ttcce->ttc.base_addr = base;
433 ttcce->ce.name = "ttc_clockevent";
434 ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
435 ttcce->ce.set_next_event = ttc_set_next_event;
436 ttcce->ce.set_state_shutdown = ttc_shutdown;
437 ttcce->ce.set_state_periodic = ttc_set_periodic;
438 ttcce->ce.set_state_oneshot = ttc_shutdown;
439 ttcce->ce.tick_resume = ttc_resume;
440 ttcce->ce.rating = 200;
441 ttcce->ce.irq = irq;
442 ttcce->ce.cpumask = cpu_possible_mask;
443
444 /*
445 * Setup the clock event timer to be an interval timer which
446 * is prescaled by 32 using the interval interrupt. Leave it
447 * disabled for now.
448 */
449 writel_relaxed(0x23, ttcce->ttc.base_addr + TTC_CNT_CNTRL_OFFSET);
450 writel_relaxed(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN,
451 ttcce->ttc.base_addr + TTC_CLK_CNTRL_OFFSET);
452 writel_relaxed(0x1, ttcce->ttc.base_addr + TTC_IER_OFFSET);
453
454 err = request_irq(irq, ttc_clock_event_interrupt,
455 IRQF_TIMER, ttcce->ce.name, ttcce);
456 if (err)
457 goto out_kfree;
458
459 clockevents_config_and_register(&ttcce->ce,
460 ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
461
462 return 0;
463
464 out_kfree:
465 kfree(ttcce);
466 return err;
467 }
468
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months
drivers/gpu/drm/mcde/mcde_display.c:543 mcde_configure_channel() error: uninitialized symbol 'val'.
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e28c0d7c92c89016c12a677616668957351e7542
commit: 709c27730a11d6681297d733eb8ee18166e9c38a drm/mcde: Fix display data flow control
config: i386-randconfig-m021-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
drivers/gpu/drm/mcde/mcde_display.c:543 mcde_configure_channel() error: uninitialized symbol 'val'.
vim +/val +543 drivers/gpu/drm/mcde/mcde_display.c
5fc537bfd00033a Linus Walleij 2019-05-24 458 static void mcde_configure_channel(struct mcde *mcde, enum mcde_channel ch,
5fc537bfd00033a Linus Walleij 2019-05-24 459 enum mcde_fifo fifo,
5fc537bfd00033a Linus Walleij 2019-05-24 460 const struct drm_display_mode *mode)
5fc537bfd00033a Linus Walleij 2019-05-24 461 {
5fc537bfd00033a Linus Walleij 2019-05-24 462 u32 val;
5fc537bfd00033a Linus Walleij 2019-05-24 463 u32 conf;
5fc537bfd00033a Linus Walleij 2019-05-24 464 u32 sync;
5fc537bfd00033a Linus Walleij 2019-05-24 465 u32 stat;
5fc537bfd00033a Linus Walleij 2019-05-24 466 u32 bgcol;
5fc537bfd00033a Linus Walleij 2019-05-24 467 u32 mux;
5fc537bfd00033a Linus Walleij 2019-05-24 468
5fc537bfd00033a Linus Walleij 2019-05-24 469 switch (ch) {
5fc537bfd00033a Linus Walleij 2019-05-24 470 case MCDE_CHANNEL_0:
5fc537bfd00033a Linus Walleij 2019-05-24 471 conf = MCDE_CHNL0CONF;
5fc537bfd00033a Linus Walleij 2019-05-24 472 sync = MCDE_CHNL0SYNCHMOD;
5fc537bfd00033a Linus Walleij 2019-05-24 473 stat = MCDE_CHNL0STAT;
5fc537bfd00033a Linus Walleij 2019-05-24 474 bgcol = MCDE_CHNL0BCKGNDCOL;
5fc537bfd00033a Linus Walleij 2019-05-24 475 mux = MCDE_CHNL0MUXING;
5fc537bfd00033a Linus Walleij 2019-05-24 476 break;
5fc537bfd00033a Linus Walleij 2019-05-24 477 case MCDE_CHANNEL_1:
5fc537bfd00033a Linus Walleij 2019-05-24 478 conf = MCDE_CHNL1CONF;
5fc537bfd00033a Linus Walleij 2019-05-24 479 sync = MCDE_CHNL1SYNCHMOD;
5fc537bfd00033a Linus Walleij 2019-05-24 480 stat = MCDE_CHNL1STAT;
5fc537bfd00033a Linus Walleij 2019-05-24 481 bgcol = MCDE_CHNL1BCKGNDCOL;
5fc537bfd00033a Linus Walleij 2019-05-24 482 mux = MCDE_CHNL1MUXING;
5fc537bfd00033a Linus Walleij 2019-05-24 483 break;
5fc537bfd00033a Linus Walleij 2019-05-24 484 case MCDE_CHANNEL_2:
5fc537bfd00033a Linus Walleij 2019-05-24 485 conf = MCDE_CHNL2CONF;
5fc537bfd00033a Linus Walleij 2019-05-24 486 sync = MCDE_CHNL2SYNCHMOD;
5fc537bfd00033a Linus Walleij 2019-05-24 487 stat = MCDE_CHNL2STAT;
5fc537bfd00033a Linus Walleij 2019-05-24 488 bgcol = MCDE_CHNL2BCKGNDCOL;
5fc537bfd00033a Linus Walleij 2019-05-24 489 mux = MCDE_CHNL2MUXING;
5fc537bfd00033a Linus Walleij 2019-05-24 490 break;
5fc537bfd00033a Linus Walleij 2019-05-24 491 case MCDE_CHANNEL_3:
5fc537bfd00033a Linus Walleij 2019-05-24 492 conf = MCDE_CHNL3CONF;
5fc537bfd00033a Linus Walleij 2019-05-24 493 sync = MCDE_CHNL3SYNCHMOD;
5fc537bfd00033a Linus Walleij 2019-05-24 494 stat = MCDE_CHNL3STAT;
5fc537bfd00033a Linus Walleij 2019-05-24 495 bgcol = MCDE_CHNL3BCKGNDCOL;
5fc537bfd00033a Linus Walleij 2019-05-24 496 mux = MCDE_CHNL3MUXING;
5fc537bfd00033a Linus Walleij 2019-05-24 497 return;
5fc537bfd00033a Linus Walleij 2019-05-24 498 }
5fc537bfd00033a Linus Walleij 2019-05-24 499
5fc537bfd00033a Linus Walleij 2019-05-24 500 /* Set up channel 0 sync (based on chnl_update_registers()) */
709c27730a11d66 Linus Walleij 2020-07-29 501 switch (mcde->flow_mode) {
709c27730a11d66 Linus Walleij 2020-07-29 502 case MCDE_COMMAND_ONESHOT_FLOW:
709c27730a11d66 Linus Walleij 2020-07-29 503 /* Oneshot is achieved with software sync */
709c27730a11d66 Linus Walleij 2020-07-29 504 val = MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SOFTWARE
709c27730a11d66 Linus Walleij 2020-07-29 505 << MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SHIFT;
709c27730a11d66 Linus Walleij 2020-07-29 506 break;
709c27730a11d66 Linus Walleij 2020-07-29 507 case MCDE_COMMAND_TE_FLOW:
5fc537bfd00033a Linus Walleij 2019-05-24 508 val = MCDE_CHNLXSYNCHMOD_SRC_SYNCH_HARDWARE
5fc537bfd00033a Linus Walleij 2019-05-24 509 << MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SHIFT;
709c27730a11d66 Linus Walleij 2020-07-29 510 val |= MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_TE0
709c27730a11d66 Linus Walleij 2020-07-29 511 << MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_SHIFT;
709c27730a11d66 Linus Walleij 2020-07-29 512 break;
709c27730a11d66 Linus Walleij 2020-07-29 513 case MCDE_COMMAND_BTA_TE_FLOW:
709c27730a11d66 Linus Walleij 2020-07-29 514 val = MCDE_CHNLXSYNCHMOD_SRC_SYNCH_HARDWARE
709c27730a11d66 Linus Walleij 2020-07-29 515 << MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SHIFT;
709c27730a11d66 Linus Walleij 2020-07-29 516 /*
709c27730a11d66 Linus Walleij 2020-07-29 517 * TODO:
709c27730a11d66 Linus Walleij 2020-07-29 518 * The vendor driver uses the formatter as sync source
709c27730a11d66 Linus Walleij 2020-07-29 519 * for BTA TE mode. Test to use TE if you have a panel
709c27730a11d66 Linus Walleij 2020-07-29 520 * that uses this mode.
709c27730a11d66 Linus Walleij 2020-07-29 521 */
709c27730a11d66 Linus Walleij 2020-07-29 522 val |= MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_FORMATTER
709c27730a11d66 Linus Walleij 2020-07-29 523 << MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_SHIFT;
709c27730a11d66 Linus Walleij 2020-07-29 524 break;
709c27730a11d66 Linus Walleij 2020-07-29 525 case MCDE_VIDEO_TE_FLOW:
709c27730a11d66 Linus Walleij 2020-07-29 526 val = MCDE_CHNLXSYNCHMOD_SRC_SYNCH_HARDWARE
5fc537bfd00033a Linus Walleij 2019-05-24 527 << MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SHIFT;
d920e8da3d837bc Stephan Gerhold 2019-11-06 528 val |= MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_TE0
d920e8da3d837bc Stephan Gerhold 2019-11-06 529 << MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_SHIFT;
709c27730a11d66 Linus Walleij 2020-07-29 530 break;
709c27730a11d66 Linus Walleij 2020-07-29 531 case MCDE_VIDEO_FORMATTER_FLOW:
709c27730a11d66 Linus Walleij 2020-07-29 532 val = MCDE_CHNLXSYNCHMOD_SRC_SYNCH_HARDWARE
709c27730a11d66 Linus Walleij 2020-07-29 533 << MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SHIFT;
5fc537bfd00033a Linus Walleij 2019-05-24 534 val |= MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_FORMATTER
5fc537bfd00033a Linus Walleij 2019-05-24 535 << MCDE_CHNLXSYNCHMOD_OUT_SYNCH_SRC_SHIFT;
709c27730a11d66 Linus Walleij 2020-07-29 536 break;
709c27730a11d66 Linus Walleij 2020-07-29 537 default:
709c27730a11d66 Linus Walleij 2020-07-29 538 dev_err(mcde->dev, "unknown flow mode %d\n",
709c27730a11d66 Linus Walleij 2020-07-29 539 mcde->flow_mode);
709c27730a11d66 Linus Walleij 2020-07-29 540 break;
Not initialized on this path
709c27730a11d66 Linus Walleij 2020-07-29 541 }
d920e8da3d837bc Stephan Gerhold 2019-11-06 542
5fc537bfd00033a Linus Walleij 2019-05-24 @543 writel(val, mcde->regs + sync);
^^^
5fc537bfd00033a Linus Walleij 2019-05-24 544
5fc537bfd00033a Linus Walleij 2019-05-24 545 /* Set up pixels per line and lines per frame */
5fc537bfd00033a Linus Walleij 2019-05-24 546 val = (mode->hdisplay - 1) << MCDE_CHNLXCONF_PPL_SHIFT;
5fc537bfd00033a Linus Walleij 2019-05-24 547 val |= (mode->vdisplay - 1) << MCDE_CHNLXCONF_LPF_SHIFT;
5fc537bfd00033a Linus Walleij 2019-05-24 548 writel(val, mcde->regs + conf);
5fc537bfd00033a Linus Walleij 2019-05-24 549
5fc537bfd00033a Linus Walleij 2019-05-24 550 /*
5fc537bfd00033a Linus Walleij 2019-05-24 551 * Normalize color conversion:
5fc537bfd00033a Linus Walleij 2019-05-24 552 * black background, OLED conversion disable on channel
5fc537bfd00033a Linus Walleij 2019-05-24 553 */
5fc537bfd00033a Linus Walleij 2019-05-24 554 val = MCDE_CHNLXSTAT_CHNLBLBCKGND_EN |
5fc537bfd00033a Linus Walleij 2019-05-24 555 MCDE_CHNLXSTAT_CHNLRD;
5fc537bfd00033a Linus Walleij 2019-05-24 556 writel(val, mcde->regs + stat);
5fc537bfd00033a Linus Walleij 2019-05-24 557 writel(0, mcde->regs + bgcol);
5fc537bfd00033a Linus Walleij 2019-05-24 558
5fc537bfd00033a Linus Walleij 2019-05-24 559 /* Set up muxing: connect the channel to the desired FIFO */
5fc537bfd00033a Linus Walleij 2019-05-24 560 switch (fifo) {
5fc537bfd00033a Linus Walleij 2019-05-24 561 case MCDE_FIFO_A:
5fc537bfd00033a Linus Walleij 2019-05-24 562 writel(MCDE_CHNLXMUXING_FIFO_ID_FIFO_A,
5fc537bfd00033a Linus Walleij 2019-05-24 563 mcde->regs + mux);
5fc537bfd00033a Linus Walleij 2019-05-24 564 break;
5fc537bfd00033a Linus Walleij 2019-05-24 565 case MCDE_FIFO_B:
5fc537bfd00033a Linus Walleij 2019-05-24 566 writel(MCDE_CHNLXMUXING_FIFO_ID_FIFO_B,
5fc537bfd00033a Linus Walleij 2019-05-24 567 mcde->regs + mux);
5fc537bfd00033a Linus Walleij 2019-05-24 568 break;
5fc537bfd00033a Linus Walleij 2019-05-24 569 }
5fc537bfd00033a Linus Walleij 2019-05-24 570 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months
[leon-rdma:rdma-next 3/31] drivers/infiniband/core/counters.c:154 alloc_and_bind() error: double unlocked 'port_counter->lock' (orig line 139)
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git rdma-next
head: 00379b407ab12167a4a0e8264392c8c9bfb5ef2d
commit: a65107565e609c005cb5a3b12d41697ac25eb3d2 [3/31] RDMA/counter: Combine allocation and bind logic
config: i386-randconfig-m021-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/infiniband/core/counters.c:154 alloc_and_bind() error: double unlocked 'port_counter->lock' (orig line 139)
vim +154 drivers/infiniband/core/counters.c
a65107565e609c Leon Romanovsky 2020-08-16 98 static struct rdma_counter *alloc_and_bind(struct ib_device *dev, u8 port,
a65107565e609c Leon Romanovsky 2020-08-16 99 struct ib_qp *qp,
99fa331dc8629b Mark Zhang 2019-07-02 100 enum rdma_nl_counter_mode mode)
99fa331dc8629b Mark Zhang 2019-07-02 101 {
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 102 struct rdma_port_counter *port_counter;
99fa331dc8629b Mark Zhang 2019-07-02 103 struct rdma_counter *counter;
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 104 int ret;
99fa331dc8629b Mark Zhang 2019-07-02 105
c4ffee7c9bdba7 Mark Zhang 2019-07-02 106 if (!dev->ops.counter_dealloc || !dev->ops.counter_alloc_stats)
99fa331dc8629b Mark Zhang 2019-07-02 107 return NULL;
99fa331dc8629b Mark Zhang 2019-07-02 108
99fa331dc8629b Mark Zhang 2019-07-02 109 counter = kzalloc(sizeof(*counter), GFP_KERNEL);
99fa331dc8629b Mark Zhang 2019-07-02 110 if (!counter)
99fa331dc8629b Mark Zhang 2019-07-02 111 return NULL;
99fa331dc8629b Mark Zhang 2019-07-02 112
99fa331dc8629b Mark Zhang 2019-07-02 113 counter->device = dev;
99fa331dc8629b Mark Zhang 2019-07-02 114 counter->port = port;
13ef5539def732 Leon Romanovsky 2020-09-22 115
13ef5539def732 Leon Romanovsky 2020-09-22 116 rdma_restrack_new(&counter->res, RDMA_RESTRACK_COUNTER);
c4ffee7c9bdba7 Mark Zhang 2019-07-02 117 counter->stats = dev->ops.counter_alloc_stats(counter);
c4ffee7c9bdba7 Mark Zhang 2019-07-02 118 if (!counter->stats)
c4ffee7c9bdba7 Mark Zhang 2019-07-02 119 goto err_stats;
c4ffee7c9bdba7 Mark Zhang 2019-07-02 120
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 121 port_counter = &dev->port_data[port].port_counter;
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 122 mutex_lock(&port_counter->lock);
a65107565e609c Leon Romanovsky 2020-08-16 123 switch (mode) {
a65107565e609c Leon Romanovsky 2020-08-16 124 case RDMA_COUNTER_MODE_MANUAL:
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 125 ret = __counter_set_mode(&port_counter->mode,
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 126 RDMA_COUNTER_MODE_MANUAL, 0);
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 127 if (ret)
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 128 goto err_mode;
a65107565e609c Leon Romanovsky 2020-08-16 129 break;
a65107565e609c Leon Romanovsky 2020-08-16 130 case RDMA_COUNTER_MODE_AUTO:
a65107565e609c Leon Romanovsky 2020-08-16 131 auto_mode_init_counter(counter, qp, port_counter->mode.mask);
a65107565e609c Leon Romanovsky 2020-08-16 132 break;
a65107565e609c Leon Romanovsky 2020-08-16 133 default:
a65107565e609c Leon Romanovsky 2020-08-16 134 ret = -EOPNOTSUPP;
a65107565e609c Leon Romanovsky 2020-08-16 135 goto err_mode;
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 136 }
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 137
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 138 port_counter->num_counters++;
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 @139 mutex_unlock(&port_counter->lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unlocked
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 140
99fa331dc8629b Mark Zhang 2019-07-02 141 counter->mode.mode = mode;
99fa331dc8629b Mark Zhang 2019-07-02 142 kref_init(&counter->kref);
99fa331dc8629b Mark Zhang 2019-07-02 143 mutex_init(&counter->lock);
99fa331dc8629b Mark Zhang 2019-07-02 144
a65107565e609c Leon Romanovsky 2020-08-16 145 ret = __rdma_counter_bind_qp(counter, qp);
a65107565e609c Leon Romanovsky 2020-08-16 146 if (ret)
a65107565e609c Leon Romanovsky 2020-08-16 147 goto err_mode;
^^^^^^^^^^^^^
Goto
a65107565e609c Leon Romanovsky 2020-08-16 148
a65107565e609c Leon Romanovsky 2020-08-16 149 rdma_restrack_parent_name(&counter->res, &qp->res);
a65107565e609c Leon Romanovsky 2020-08-16 150 rdma_restrack_add(&counter->res);
99fa331dc8629b Mark Zhang 2019-07-02 151 return counter;
c4ffee7c9bdba7 Mark Zhang 2019-07-02 152
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 153 err_mode:
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 @154 mutex_unlock(&port_counter->lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unlocked again
1bd8e0a9d0fd1b Mark Zhang 2019-07-02 155 kfree(counter->stats);
c4ffee7c9bdba7 Mark Zhang 2019-07-02 156 err_stats:
13ef5539def732 Leon Romanovsky 2020-09-22 157 rdma_restrack_put(&counter->res);
c4ffee7c9bdba7 Mark Zhang 2019-07-02 158 kfree(counter);
c4ffee7c9bdba7 Mark Zhang 2019-07-02 159 return NULL;
99fa331dc8629b Mark Zhang 2019-07-02 160 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months
Re: [Intel-gfx] [PATCH 05/27] drm/i915/pxp: Enable ioctl action to set the ring3 context
by Dan Carpenter
Hi Sean,
url: https://github.com/0day-ci/linux/commits/Sean-Z-Huang/drm-i915-pxp-Introd...
base: 92edc4aef86780a8ad01b092c6d6630bb3cb423d
config: i386-randconfig-m021-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/gpu/drm/i915/pxp/intel_pxp.c:62 i915_pxp_ops_ioctl() error: we previously assumed 'i915' could be null (see line 20)
vim +/i915 +62 drivers/gpu/drm/i915/pxp/intel_pxp.c
1d109ada10e82c3 Huang, Sean Z 2020-11-13 11 int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmfile)
1d109ada10e82c3 Huang, Sean Z 2020-11-13 12 {
1d109ada10e82c3 Huang, Sean Z 2020-11-13 13 int ret;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 14 struct pxp_info pxp_info = {0};
1d109ada10e82c3 Huang, Sean Z 2020-11-13 15 struct drm_i915_pxp_ops *pxp_ops = data;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 16 struct drm_i915_private *i915 = to_i915(dev);
1d109ada10e82c3 Huang, Sean Z 2020-11-13 17
1d109ada10e82c3 Huang, Sean Z 2020-11-13 18 drm_dbg(&i915->drm, ">>> %s\n", __func__);
^^^^^^^^^
If "i915" is NULL then this will crash.
1d109ada10e82c3 Huang, Sean Z 2020-11-13 19
1d109ada10e82c3 Huang, Sean Z 2020-11-13 @20 if (!i915 || !drmfile || !pxp_ops || pxp_ops->pxp_info_size != sizeof(pxp_info)) {
^^^^
Check too late.
1d109ada10e82c3 Huang, Sean Z 2020-11-13 21 drm_dbg(&i915->drm, "Failed to %s, invalid params\n", __func__);
1d109ada10e82c3 Huang, Sean Z 2020-11-13 22 ret = -EINVAL;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 23 goto end;
This will unlock a lock that we are not holding. This should just
"return -EINVAL;". All the stuff at "goto end;" is pointless or buggy.
1d109ada10e82c3 Huang, Sean Z 2020-11-13 24 }
1d109ada10e82c3 Huang, Sean Z 2020-11-13 25
1d109ada10e82c3 Huang, Sean Z 2020-11-13 26 if (copy_from_user(&pxp_info, (void __user *)pxp_ops->pxp_info_ptr, sizeof(pxp_info)) != 0) {
1d109ada10e82c3 Huang, Sean Z 2020-11-13 27 ret = -EFAULT;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 28 goto end;
^^^^^^^^
This will unlock. Same. Just return -EFAULT;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 29 }
1d109ada10e82c3 Huang, Sean Z 2020-11-13 30
1d109ada10e82c3 Huang, Sean Z 2020-11-13 31 drm_dbg(&i915->drm, "i915 pxp ioctl call with action=[%d]\n", pxp_info.action);
1d109ada10e82c3 Huang, Sean Z 2020-11-13 32
1d109ada10e82c3 Huang, Sean Z 2020-11-13 33 mutex_lock(&i915->pxp.r0ctx->ctx_mutex);
1d109ada10e82c3 Huang, Sean Z 2020-11-13 34
1d109ada10e82c3 Huang, Sean Z 2020-11-13 35 if (i915->pxp.r0ctx->global_state_in_suspend) {
1d109ada10e82c3 Huang, Sean Z 2020-11-13 36 drm_dbg(&i915->drm, "Return failure due to state in suspend\n");
1d109ada10e82c3 Huang, Sean Z 2020-11-13 37 pxp_info.sm_status = PXP_SM_STATUS_SESSION_NOT_AVAILABLE;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 38 ret = 0;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 39 goto end;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 40 }
1d109ada10e82c3 Huang, Sean Z 2020-11-13 41
1d109ada10e82c3 Huang, Sean Z 2020-11-13 42 if (i915->pxp.r0ctx->global_state_attacked) {
1d109ada10e82c3 Huang, Sean Z 2020-11-13 43 drm_dbg(&i915->drm, "Retry required due to state attacked\n");
1d109ada10e82c3 Huang, Sean Z 2020-11-13 44 pxp_info.sm_status = PXP_SM_STATUS_RETRY_REQUIRED;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 45 ret = 0;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 46 goto end;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 47 }
1d109ada10e82c3 Huang, Sean Z 2020-11-13 48
1d109ada10e82c3 Huang, Sean Z 2020-11-13 49 switch (pxp_info.action) {
1d109ada10e82c3 Huang, Sean Z 2020-11-13 50 case PXP_ACTION_SET_R3_CONTEXT:
1d109ada10e82c3 Huang, Sean Z 2020-11-13 51 {
1d109ada10e82c3 Huang, Sean Z 2020-11-13 52 ret = intel_pxp_set_r3ctx(i915, pxp_info.set_r3ctx);
1d109ada10e82c3 Huang, Sean Z 2020-11-13 53 break;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 54 }
1d109ada10e82c3 Huang, Sean Z 2020-11-13 55 default:
1d109ada10e82c3 Huang, Sean Z 2020-11-13 56 drm_dbg(&i915->drm, "Failed to %s due to bad params\n", __func__);
1d109ada10e82c3 Huang, Sean Z 2020-11-13 57 ret = -EINVAL;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 58 goto end;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 59 }
1d109ada10e82c3 Huang, Sean Z 2020-11-13 60
1d109ada10e82c3 Huang, Sean Z 2020-11-13 61 end:
1d109ada10e82c3 Huang, Sean Z 2020-11-13 @62 mutex_unlock(&i915->pxp.r0ctx->ctx_mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1d109ada10e82c3 Huang, Sean Z 2020-11-13 63
1d109ada10e82c3 Huang, Sean Z 2020-11-13 64 if (ret == 0)
1d109ada10e82c3 Huang, Sean Z 2020-11-13 65 if (copy_to_user((void __user *)pxp_ops->pxp_info_ptr, &pxp_info, sizeof(pxp_info)) != 0)
1d109ada10e82c3 Huang, Sean Z 2020-11-13 66 ret = -EFAULT;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 67
1d109ada10e82c3 Huang, Sean Z 2020-11-13 68 if (ret)
1d109ada10e82c3 Huang, Sean Z 2020-11-13 69 dev_err(&dev->pdev->dev, "pid=%d, ret = %d\n", task_pid_nr(current), ret);
1d109ada10e82c3 Huang, Sean Z 2020-11-13 70
1d109ada10e82c3 Huang, Sean Z 2020-11-13 71 drm_dbg(&i915->drm, "<<< %s\n", __func__);
Delete this printk() and use ftrace for this information.
1d109ada10e82c3 Huang, Sean Z 2020-11-13 72 return ret;
1d109ada10e82c3 Huang, Sean Z 2020-11-13 73 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months
[drm-tip:drm-tip 1117/1129] drivers/gpu/drm/drm_atomic_uapi.c:342 drm_atomic_set_crtc_for_connector() error: we previously assumed 'crtc' could be null (see line 326)
by Dan Carpenter
tree: git://anongit.freedesktop.org/drm/drm-tip drm-tip
head: af383973ac39069d9ffcac0287a896a107005d54
commit: e3aae683e861a987d3d7dca593aaff93ac001bcb [1117/1129] drm: convert drm_atomic_uapi.c to new debug helpers
config: i386-randconfig-m021-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/gpu/drm/drm_atomic_uapi.c:342 drm_atomic_set_crtc_for_connector() error: we previously assumed 'crtc' could be null (see line 326)
vim +/crtc +342 drivers/gpu/drm/drm_atomic_uapi.c
72fdb40c1a4b48f Daniel Vetter 2018-09-05 305 int
72fdb40c1a4b48f Daniel Vetter 2018-09-05 306 drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 307 struct drm_crtc *crtc)
72fdb40c1a4b48f Daniel Vetter 2018-09-05 308 {
72fdb40c1a4b48f Daniel Vetter 2018-09-05 309 struct drm_connector *connector = conn_state->connector;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 310 struct drm_crtc_state *crtc_state;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 311
72fdb40c1a4b48f Daniel Vetter 2018-09-05 312 if (conn_state->crtc == crtc)
72fdb40c1a4b48f Daniel Vetter 2018-09-05 313 return 0;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 314
72fdb40c1a4b48f Daniel Vetter 2018-09-05 315 if (conn_state->crtc) {
72fdb40c1a4b48f Daniel Vetter 2018-09-05 316 crtc_state = drm_atomic_get_new_crtc_state(conn_state->state,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 317 conn_state->crtc);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 318
72fdb40c1a4b48f Daniel Vetter 2018-09-05 319 crtc_state->connector_mask &=
72fdb40c1a4b48f Daniel Vetter 2018-09-05 320 ~drm_connector_mask(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 321
72fdb40c1a4b48f Daniel Vetter 2018-09-05 322 drm_connector_put(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 323 conn_state->crtc = NULL;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 324 }
72fdb40c1a4b48f Daniel Vetter 2018-09-05 325
72fdb40c1a4b48f Daniel Vetter 2018-09-05 @326 if (crtc) {
^^^^
If "crtc" is NULL the error message will crash
72fdb40c1a4b48f Daniel Vetter 2018-09-05 327 crtc_state = drm_atomic_get_crtc_state(conn_state->state, crtc);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 328 if (IS_ERR(crtc_state))
72fdb40c1a4b48f Daniel Vetter 2018-09-05 329 return PTR_ERR(crtc_state);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 330
72fdb40c1a4b48f Daniel Vetter 2018-09-05 331 crtc_state->connector_mask |=
72fdb40c1a4b48f Daniel Vetter 2018-09-05 332 drm_connector_mask(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 333
72fdb40c1a4b48f Daniel Vetter 2018-09-05 334 drm_connector_get(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 335 conn_state->crtc = crtc;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 336
e3aae683e861a98 Simon Ser 2020-11-11 337 drm_dbg_atomic(crtc->dev,
e3aae683e861a98 Simon Ser 2020-11-11 338 "Link [CONNECTOR:%d:%s] state %p to [CRTC:%d:%s]\n",
72fdb40c1a4b48f Daniel Vetter 2018-09-05 339 connector->base.id, connector->name,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 340 conn_state, crtc->base.id, crtc->name);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 341 } else {
e3aae683e861a98 Simon Ser 2020-11-11 @342 drm_dbg_atomic(crtc->dev,
^^^^^^^^^
BOOM!
e3aae683e861a98 Simon Ser 2020-11-11 343 "Link [CONNECTOR:%d:%s] state %p to [NOCRTC]\n",
72fdb40c1a4b48f Daniel Vetter 2018-09-05 344 connector->base.id, connector->name,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 345 conn_state);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 346 }
72fdb40c1a4b48f Daniel Vetter 2018-09-05 347
72fdb40c1a4b48f Daniel Vetter 2018-09-05 348 return 0;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 349 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 10 months