[PATCH] powerpc/kexec: fix for_each_child.cocci warning
by Julia Lawall
From: kernel test robot <lkp(a)intel.com>
for_each_node_by_type should have of_node_put() before return.
Generated by: scripts/coccinelle/iterators/for_each_child.cocci
CC: Sumera Priyadarsini <sylphrenadin(a)gmail.com>
Reported-by: kernel test robot <lkp(a)intel.com>
Signed-off-by: kernel test robot <lkp(a)intel.com>
---
The code seems to have been this way since the beginning of time. Perhaps
the of_node_put is a no op for this code?
core_64.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/arch/powerpc/kexec/core_64.c
+++ b/arch/powerpc/kexec/core_64.c
@@ -64,8 +64,10 @@ int default_machine_kexec_prepare(struct
begin = image->segment[i].mem;
end = begin + image->segment[i].memsz;
- if ((begin < high) && (end > low))
+ if ((begin < high) && (end > low)) {
+ of_node_put(node);
return -ETXTBSY;
+ }
}
}
1 year, 1 month
[mcgrof-next:20210817-add-disk-error-handling-next 2/89] drivers/scsi/st.c:3830:38: error: 'struct scsi_tape' has no member named 'disk'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210817-add-disk-error-handling-next
head: 3d00c210d7fd616243af9cf41829f4a56f116ba8
commit: 7692839b26192b737a64c87970b6589e6a909d38 [2/89] st: do not allocate a gendisk
config: x86_64-randconfig-a006-20210816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/com...
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210817-add-disk-error-handling-next
git checkout 7692839b26192b737a64c87970b6589e6a909d38
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
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/scsi/st.c: In function 'st_ioctl':
>> drivers/scsi/st.c:3830:38: error: 'struct scsi_tape' has no member named 'disk'
3830 | retval = scsi_ioctl(STp->device, STp->disk, file->f_mode, cmd_in, p);
| ^~
vim +3830 drivers/scsi/st.c
8038e6456a3e6f Kai Makisara 2016-02-09 3348
8038e6456a3e6f Kai Makisara 2016-02-09 3349
^1da177e4c3f41 Linus Torvalds 2005-04-16 3350 /* Partition the tape into two partitions if size > 0 or one partition if
^1da177e4c3f41 Linus Torvalds 2005-04-16 3351 size == 0.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3352
^1da177e4c3f41 Linus Torvalds 2005-04-16 3353 The block descriptors are read and written because Sony SDT-7000 does not
^1da177e4c3f41 Linus Torvalds 2005-04-16 3354 work without this (suggestion from Michael Schaefer <Michael.Schaefer(a)dlr.de>).
^1da177e4c3f41 Linus Torvalds 2005-04-16 3355
^1da177e4c3f41 Linus Torvalds 2005-04-16 3356 My HP C1533A drive returns only one partition size field. This is used to
^1da177e4c3f41 Linus Torvalds 2005-04-16 3357 set the size of partition 1. There is no size field for the default partition.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3358 Michael Schaefer's Sony SDT-7000 returns two descriptors and the second is
^1da177e4c3f41 Linus Torvalds 2005-04-16 3359 used to set the size of partition 1 (this is what the SCSI-3 standard specifies).
^1da177e4c3f41 Linus Torvalds 2005-04-16 3360 The following algorithm is used to accommodate both drives: if the number of
^1da177e4c3f41 Linus Torvalds 2005-04-16 3361 partition size fields is greater than the maximum number of additional partitions
^1da177e4c3f41 Linus Torvalds 2005-04-16 3362 in the mode page, the second field is used. Otherwise the first field is used.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3363
^1da177e4c3f41 Linus Torvalds 2005-04-16 3364 For Seagate DDS drives the page length must be 8 when no partitions is defined
^1da177e4c3f41 Linus Torvalds 2005-04-16 3365 and 10 when 1 partition is defined (information from Eric Lee Green). This is
^1da177e4c3f41 Linus Torvalds 2005-04-16 3366 is acceptable also to some other old drives and enforced if the first partition
^1da177e4c3f41 Linus Torvalds 2005-04-16 3367 size field is used for the first additional partition size.
8038e6456a3e6f Kai Makisara 2016-02-09 3368
8038e6456a3e6f Kai Makisara 2016-02-09 3369 For drives that advertize SCSI-3 or newer, use the SSC-3 methods.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3370 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3371 static int partition_tape(struct scsi_tape *STp, int size)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3372 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3373 int result;
8038e6456a3e6f Kai Makisara 2016-02-09 3374 int target_partition;
8038e6456a3e6f Kai Makisara 2016-02-09 3375 bool scsi3 = STp->device->scsi_level >= SCSI_3, needs_format = false;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3376 int pgo, psd_cnt, psdo;
8038e6456a3e6f Kai Makisara 2016-02-09 3377 int psum = PP_MSK_PSUM_MB, units = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3378 unsigned char *bp;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3379
^1da177e4c3f41 Linus Torvalds 2005-04-16 3380 result = read_mode_page(STp, PART_PAGE, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3381 if (result) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3382 DEBC_printk(STp, "Can't read partition mode page.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3383 return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3384 }
8038e6456a3e6f Kai Makisara 2016-02-09 3385 target_partition = 1;
8038e6456a3e6f Kai Makisara 2016-02-09 3386 if (size < 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3387 target_partition = 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3388 size = -size;
8038e6456a3e6f Kai Makisara 2016-02-09 3389 }
8038e6456a3e6f Kai Makisara 2016-02-09 3390
^1da177e4c3f41 Linus Torvalds 2005-04-16 3391 /* The mode page is in the buffer. Let's modify it and write it. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3392 bp = (STp->buffer)->b_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3393 pgo = MODE_HEADER_LENGTH + bp[MH_OFF_BDESCS_LENGTH];
b30d8bca5b525b Hannes Reinecke 2014-06-25 3394 DEBC_printk(STp, "Partition page length is %d bytes.\n",
b30d8bca5b525b Hannes Reinecke 2014-06-25 3395 bp[pgo + MP_OFF_PAGE_LENGTH] + 2);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3396
^1da177e4c3f41 Linus Torvalds 2005-04-16 3397 psd_cnt = (bp[pgo + MP_OFF_PAGE_LENGTH] + 2 - PART_PAGE_FIXED_LENGTH) / 2;
8038e6456a3e6f Kai Makisara 2016-02-09 3398
8038e6456a3e6f Kai Makisara 2016-02-09 3399 if (scsi3) {
8038e6456a3e6f Kai Makisara 2016-02-09 3400 needs_format = (bp[pgo + PP_OFF_FLAGS] & PP_MSK_POFM) != 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3401 if (needs_format && size == 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3402 /* No need to write the mode page when clearing
8038e6456a3e6f Kai Makisara 2016-02-09 3403 * partitioning
8038e6456a3e6f Kai Makisara 2016-02-09 3404 */
8038e6456a3e6f Kai Makisara 2016-02-09 3405 DEBC_printk(STp, "Formatting tape with one partition.\n");
8038e6456a3e6f Kai Makisara 2016-02-09 3406 result = format_medium(STp, 0);
8038e6456a3e6f Kai Makisara 2016-02-09 3407 goto out;
8038e6456a3e6f Kai Makisara 2016-02-09 3408 }
8038e6456a3e6f Kai Makisara 2016-02-09 3409 if (needs_format) /* Leave the old value for HP DATs claiming SCSI_3 */
8038e6456a3e6f Kai Makisara 2016-02-09 3410 psd_cnt = 2;
8038e6456a3e6f Kai Makisara 2016-02-09 3411 if ((bp[pgo + PP_OFF_FLAGS] & PP_MSK_PSUM_UNITS) == PP_MSK_PSUM_UNITS) {
8038e6456a3e6f Kai Makisara 2016-02-09 3412 /* Use units scaling for large partitions if the device
8038e6456a3e6f Kai Makisara 2016-02-09 3413 * suggests it and no precision lost. Required for IBM
8038e6456a3e6f Kai Makisara 2016-02-09 3414 * TS1140/50 drives that don't support MB units.
8038e6456a3e6f Kai Makisara 2016-02-09 3415 */
8038e6456a3e6f Kai Makisara 2016-02-09 3416 if (size >= 1000 && (size % 1000) == 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3417 size /= 1000;
8038e6456a3e6f Kai Makisara 2016-02-09 3418 psum = PP_MSK_PSUM_UNITS;
8038e6456a3e6f Kai Makisara 2016-02-09 3419 units = 9; /* GB */
8038e6456a3e6f Kai Makisara 2016-02-09 3420 }
8038e6456a3e6f Kai Makisara 2016-02-09 3421 }
8038e6456a3e6f Kai Makisara 2016-02-09 3422 /* Try it anyway if too large to specify in MB */
8038e6456a3e6f Kai Makisara 2016-02-09 3423 if (psum == PP_MSK_PSUM_MB && size >= 65534) {
8038e6456a3e6f Kai Makisara 2016-02-09 3424 size /= 1000;
8038e6456a3e6f Kai Makisara 2016-02-09 3425 psum = PP_MSK_PSUM_UNITS;
8038e6456a3e6f Kai Makisara 2016-02-09 3426 units = 9; /* GB */
8038e6456a3e6f Kai Makisara 2016-02-09 3427 }
8038e6456a3e6f Kai Makisara 2016-02-09 3428 }
8038e6456a3e6f Kai Makisara 2016-02-09 3429
8038e6456a3e6f Kai Makisara 2016-02-09 3430 if (size >= 65535 || /* Does not fit into two bytes */
8038e6456a3e6f Kai Makisara 2016-02-09 3431 (target_partition == 0 && psd_cnt < 2)) {
8038e6456a3e6f Kai Makisara 2016-02-09 3432 result = -EINVAL;
8038e6456a3e6f Kai Makisara 2016-02-09 3433 goto out;
8038e6456a3e6f Kai Makisara 2016-02-09 3434 }
8038e6456a3e6f Kai Makisara 2016-02-09 3435
^1da177e4c3f41 Linus Torvalds 2005-04-16 3436 psdo = pgo + PART_PAGE_FIXED_LENGTH;
8038e6456a3e6f Kai Makisara 2016-02-09 3437 /* The second condition is for HP DDS which use only one partition size
8038e6456a3e6f Kai Makisara 2016-02-09 3438 * descriptor
8038e6456a3e6f Kai Makisara 2016-02-09 3439 */
8038e6456a3e6f Kai Makisara 2016-02-09 3440 if (target_partition > 0 &&
8038e6456a3e6f Kai Makisara 2016-02-09 3441 (psd_cnt > bp[pgo + PP_OFF_MAX_ADD_PARTS] ||
8038e6456a3e6f Kai Makisara 2016-02-09 3442 bp[pgo + PP_OFF_MAX_ADD_PARTS] != 1)) {
8038e6456a3e6f Kai Makisara 2016-02-09 3443 bp[psdo] = bp[psdo + 1] = 0xff; /* Rest to partition 0 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3444 psdo += 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3445 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3446 memset(bp + psdo, 0, bp[pgo + PP_OFF_NBR_ADD_PARTS] * 2);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3447
b30d8bca5b525b Hannes Reinecke 2014-06-25 3448 DEBC_printk(STp, "psd_cnt %d, max.parts %d, nbr_parts %d\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3449 psd_cnt, bp[pgo + PP_OFF_MAX_ADD_PARTS],
b30d8bca5b525b Hannes Reinecke 2014-06-25 3450 bp[pgo + PP_OFF_NBR_ADD_PARTS]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3451
8038e6456a3e6f Kai Makisara 2016-02-09 3452 if (size == 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3453 bp[pgo + PP_OFF_NBR_ADD_PARTS] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3454 if (psd_cnt <= bp[pgo + PP_OFF_MAX_ADD_PARTS])
^1da177e4c3f41 Linus Torvalds 2005-04-16 3455 bp[pgo + MP_OFF_PAGE_LENGTH] = 6;
b30d8bca5b525b Hannes Reinecke 2014-06-25 3456 DEBC_printk(STp, "Formatting tape with one partition.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3457 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3458 bp[psdo] = (size >> 8) & 0xff;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3459 bp[psdo + 1] = size & 0xff;
8038e6456a3e6f Kai Makisara 2016-02-09 3460 if (target_partition == 0)
8038e6456a3e6f Kai Makisara 2016-02-09 3461 bp[psdo + 2] = bp[psdo + 3] = 0xff;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3462 bp[pgo + 3] = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3463 if (bp[pgo + MP_OFF_PAGE_LENGTH] < 8)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3464 bp[pgo + MP_OFF_PAGE_LENGTH] = 8;
8038e6456a3e6f Kai Makisara 2016-02-09 3465 DEBC_printk(STp,
8038e6456a3e6f Kai Makisara 2016-02-09 3466 "Formatting tape with two partitions (%i = %d MB).\n",
8038e6456a3e6f Kai Makisara 2016-02-09 3467 target_partition, units > 0 ? size * 1000 : size);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3468 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3469 bp[pgo + PP_OFF_PART_UNITS] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3470 bp[pgo + PP_OFF_RESERVED] = 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3471 if (size != 1 || units != 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3472 bp[pgo + PP_OFF_FLAGS] = PP_BIT_IDP | psum |
8038e6456a3e6f Kai Makisara 2016-02-09 3473 (bp[pgo + PP_OFF_FLAGS] & 0x07);
8038e6456a3e6f Kai Makisara 2016-02-09 3474 bp[pgo + PP_OFF_PART_UNITS] = units;
8038e6456a3e6f Kai Makisara 2016-02-09 3475 } else
8038e6456a3e6f Kai Makisara 2016-02-09 3476 bp[pgo + PP_OFF_FLAGS] = PP_BIT_FDP |
8038e6456a3e6f Kai Makisara 2016-02-09 3477 (bp[pgo + PP_OFF_FLAGS] & 0x1f);
8038e6456a3e6f Kai Makisara 2016-02-09 3478 bp[pgo + MP_OFF_PAGE_LENGTH] = 6 + psd_cnt * 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3479
^1da177e4c3f41 Linus Torvalds 2005-04-16 3480 result = write_mode_page(STp, PART_PAGE, 1);
8038e6456a3e6f Kai Makisara 2016-02-09 3481
8038e6456a3e6f Kai Makisara 2016-02-09 3482 if (!result && needs_format)
8038e6456a3e6f Kai Makisara 2016-02-09 3483 result = format_medium(STp, 1);
8038e6456a3e6f Kai Makisara 2016-02-09 3484
^1da177e4c3f41 Linus Torvalds 2005-04-16 3485 if (result) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3486 st_printk(KERN_INFO, STp, "Partitioning of tape failed.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3487 result = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3488 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3489
8038e6456a3e6f Kai Makisara 2016-02-09 3490 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3491 return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3492 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3493
^1da177e4c3f41 Linus Torvalds 2005-04-16 3494
^1da177e4c3f41 Linus Torvalds 2005-04-16 3495
^1da177e4c3f41 Linus Torvalds 2005-04-16 3496 /* The ioctl command */
dba7688fc9037c Christoph Hellwig 2021-07-24 3497 static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3498 {
dba7688fc9037c Christoph Hellwig 2021-07-24 3499 void __user *p = (void __user *)arg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3500 int i, cmd_nr, cmd_type, bt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3501 int retval = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3502 unsigned int blk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3503 struct scsi_tape *STp = file->private_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3504 struct st_modedef *STm;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3505 struct st_partstat *STps;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3506
28f85009e0cf6a Matthias Kaehlcke 2007-07-29 3507 if (mutex_lock_interruptible(&STp->lock))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3508 return -ERESTARTSYS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3509
^1da177e4c3f41 Linus Torvalds 2005-04-16 3510 DEB(
^1da177e4c3f41 Linus Torvalds 2005-04-16 3511 if (debugging && !STp->in_use) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3512 st_printk(ST_DEB_MSG, STp, "Incorrect device.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3513 retval = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3514 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3515 } ) /* end DEB */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3516
^1da177e4c3f41 Linus Torvalds 2005-04-16 3517 STm = &(STp->modes[STp->current_mode]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3518 STps = &(STp->ps[STp->partition]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3519
^1da177e4c3f41 Linus Torvalds 2005-04-16 3520 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 3521 * If we are in the middle of error recovery, don't let anyone
^1da177e4c3f41 Linus Torvalds 2005-04-16 3522 * else try and use this device. Also, if error recovery fails, it
^1da177e4c3f41 Linus Torvalds 2005-04-16 3523 * may try and take the device offline, in which case all further
^1da177e4c3f41 Linus Torvalds 2005-04-16 3524 * access to the device is prohibited.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3525 */
906d15fbd23c12 Christoph Hellwig 2014-10-11 3526 retval = scsi_ioctl_block_when_processing_errors(STp->device, cmd_in,
83ff6fe8580a7c Al Viro 2008-03-02 3527 file->f_flags & O_NDELAY);
906d15fbd23c12 Christoph Hellwig 2014-10-11 3528 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3529 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3530
^1da177e4c3f41 Linus Torvalds 2005-04-16 3531 cmd_type = _IOC_TYPE(cmd_in);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3532 cmd_nr = _IOC_NR(cmd_in);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3533
^1da177e4c3f41 Linus Torvalds 2005-04-16 3534 if (cmd_type == _IOC_TYPE(MTIOCTOP) && cmd_nr == _IOC_NR(MTIOCTOP)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3535 struct mtop mtc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3536
^1da177e4c3f41 Linus Torvalds 2005-04-16 3537 if (_IOC_SIZE(cmd_in) != sizeof(mtc)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3538 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3539 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3540 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3541
^1da177e4c3f41 Linus Torvalds 2005-04-16 3542 i = copy_from_user(&mtc, p, sizeof(struct mtop));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3543 if (i) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3544 retval = (-EFAULT);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3545 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3546 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3547
^1da177e4c3f41 Linus Torvalds 2005-04-16 3548 if (mtc.mt_op == MTSETDRVBUFFER && !capable(CAP_SYS_ADMIN)) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3549 st_printk(KERN_WARNING, STp,
b30d8bca5b525b Hannes Reinecke 2014-06-25 3550 "MTSETDRVBUFFER only allowed for root.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3551 retval = (-EPERM);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3552 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3553 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3554 if (!STm->defined &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3555 (mtc.mt_op != MTSETDRVBUFFER &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3556 (mtc.mt_count & MT_ST_OPTIONS) == 0)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3557 retval = (-ENXIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3558 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3559 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3560
^1da177e4c3f41 Linus Torvalds 2005-04-16 3561 if (!STp->pos_unknown) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3562
^1da177e4c3f41 Linus Torvalds 2005-04-16 3563 if (STps->eof == ST_FM_HIT) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3564 if (mtc.mt_op == MTFSF || mtc.mt_op == MTFSFM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3565 mtc.mt_op == MTEOM) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3566 mtc.mt_count -= 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3567 if (STps->drv_file >= 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3568 STps->drv_file += 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3569 } else if (mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3570 mtc.mt_count += 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3571 if (STps->drv_file >= 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3572 STps->drv_file += 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3573 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3574 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3575
^1da177e4c3f41 Linus Torvalds 2005-04-16 3576 if (mtc.mt_op == MTSEEK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3577 /* Old position must be restored if partition will be
^1da177e4c3f41 Linus Torvalds 2005-04-16 3578 changed */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3579 i = !STp->can_partitions ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3580 (STp->new_partition != STp->partition);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3581 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3582 i = mtc.mt_op == MTREW || mtc.mt_op == MTOFFL ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3583 mtc.mt_op == MTRETEN || mtc.mt_op == MTEOM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3584 mtc.mt_op == MTLOCK || mtc.mt_op == MTLOAD ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3585 mtc.mt_op == MTFSF || mtc.mt_op == MTFSFM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3586 mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3587 mtc.mt_op == MTCOMPRESSION;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3588 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3589 i = flush_buffer(STp, i);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3590 if (i < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3591 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3592 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3593 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3594 if (STps->rw == ST_WRITING &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3595 (mtc.mt_op == MTREW || mtc.mt_op == MTOFFL ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3596 mtc.mt_op == MTSEEK ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3597 mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3598 i = st_int_ioctl(STp, MTWEOF, 1);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3599 if (i < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3600 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3601 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3602 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3603 if (mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3604 mtc.mt_count++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3605 STps->rw = ST_IDLE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3606 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3607
^1da177e4c3f41 Linus Torvalds 2005-04-16 3608 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3609 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 3610 * If there was a bus reset, block further access
^1da177e4c3f41 Linus Torvalds 2005-04-16 3611 * to this device. If the user wants to rewind the tape,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3612 * then reset the flag and allow access again.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3613 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3614 if (mtc.mt_op != MTREW &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3615 mtc.mt_op != MTOFFL &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3616 mtc.mt_op != MTRETEN &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3617 mtc.mt_op != MTERASE &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3618 mtc.mt_op != MTSEEK &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3619 mtc.mt_op != MTEOM) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3620 retval = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3621 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3622 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3623 reset_state(STp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3624 /* remove this when the midlevel properly clears was_reset */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3625 STp->device->was_reset = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3626 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3627
^1da177e4c3f41 Linus Torvalds 2005-04-16 3628 if (mtc.mt_op != MTNOP && mtc.mt_op != MTSETBLK &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3629 mtc.mt_op != MTSETDENSITY && mtc.mt_op != MTWSM &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3630 mtc.mt_op != MTSETDRVBUFFER && mtc.mt_op != MTSETPART)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3631 STps->rw = ST_IDLE; /* Prevent automatic WEOF and fsf */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3632
^1da177e4c3f41 Linus Torvalds 2005-04-16 3633 if (mtc.mt_op == MTOFFL && STp->door_locked != ST_UNLOCKED)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3634 do_door_lock(STp, 0); /* Ignore result! */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3635
^1da177e4c3f41 Linus Torvalds 2005-04-16 3636 if (mtc.mt_op == MTSETDRVBUFFER &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3637 (mtc.mt_count & MT_ST_OPTIONS) != 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3638 retval = st_set_options(STp, mtc.mt_count);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3639 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3640 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3641
^1da177e4c3f41 Linus Torvalds 2005-04-16 3642 if (mtc.mt_op == MTSETPART) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3643 if (!STp->can_partitions ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3644 mtc.mt_count < 0 || mtc.mt_count >= ST_NBR_PARTITIONS) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3645 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3646 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3647 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3648 if (mtc.mt_count >= STp->nbr_partitions &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3649 (STp->nbr_partitions = nbr_partitions(STp)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3650 retval = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3651 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3652 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3653 if (mtc.mt_count >= STp->nbr_partitions) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3654 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3655 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3656 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3657 STp->new_partition = mtc.mt_count;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3658 retval = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3659 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3660 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3661
^1da177e4c3f41 Linus Torvalds 2005-04-16 3662 if (mtc.mt_op == MTMKPART) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3663 if (!STp->can_partitions) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3664 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3665 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3666 }
8038e6456a3e6f Kai Makisara 2016-02-09 3667 i = do_load_unload(STp, file, 1);
8038e6456a3e6f Kai Makisara 2016-02-09 3668 if (i < 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3669 retval = i;
8038e6456a3e6f Kai Makisara 2016-02-09 3670 goto out;
8038e6456a3e6f Kai Makisara 2016-02-09 3671 }
8038e6456a3e6f Kai Makisara 2016-02-09 3672 i = partition_tape(STp, mtc.mt_count);
8038e6456a3e6f Kai Makisara 2016-02-09 3673 if (i < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3674 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3675 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3676 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3677 for (i = 0; i < ST_NBR_PARTITIONS; i++) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3678 STp->ps[i].rw = ST_IDLE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3679 STp->ps[i].at_sm = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3680 STp->ps[i].last_block_valid = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3681 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3682 STp->partition = STp->new_partition = 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3683 STp->nbr_partitions = mtc.mt_count != 0 ? 2 : 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3684 STps->drv_block = STps->drv_file = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3685 retval = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3686 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3687 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3688
^1da177e4c3f41 Linus Torvalds 2005-04-16 3689 if (mtc.mt_op == MTSEEK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3690 i = set_location(STp, mtc.mt_count, STp->new_partition, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3691 if (!STp->can_partitions)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3692 STp->ps[0].rw = ST_IDLE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3693 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3694 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3695 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3696
^1da177e4c3f41 Linus Torvalds 2005-04-16 3697 if (mtc.mt_op == MTUNLOAD || mtc.mt_op == MTOFFL) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3698 retval = do_load_unload(STp, file, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3699 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3700 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3701
^1da177e4c3f41 Linus Torvalds 2005-04-16 3702 if (mtc.mt_op == MTLOAD) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3703 retval = do_load_unload(STp, file, max(1, mtc.mt_count));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3704 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3705 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3706
^1da177e4c3f41 Linus Torvalds 2005-04-16 3707 if (mtc.mt_op == MTLOCK || mtc.mt_op == MTUNLOCK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3708 retval = do_door_lock(STp, (mtc.mt_op == MTLOCK));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3709 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3710 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3711
^1da177e4c3f41 Linus Torvalds 2005-04-16 3712 if (STp->can_partitions && STp->ready == ST_READY &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3713 (i = switch_partition(STp)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3714 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3715 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3716 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3717
^1da177e4c3f41 Linus Torvalds 2005-04-16 3718 if (mtc.mt_op == MTCOMPRESSION)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3719 retval = st_compression(STp, (mtc.mt_count & 1));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3720 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3721 retval = st_int_ioctl(STp, mtc.mt_op, mtc.mt_count);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3722 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3723 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3724 if (!STm->defined) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3725 retval = (-ENXIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3726 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3727 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3728
^1da177e4c3f41 Linus Torvalds 2005-04-16 3729 if ((i = flush_buffer(STp, 0)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3730 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3731 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3732 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3733 if (STp->can_partitions &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3734 (i = switch_partition(STp)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3735 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3736 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3737 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3738
^1da177e4c3f41 Linus Torvalds 2005-04-16 3739 if (cmd_type == _IOC_TYPE(MTIOCGET) && cmd_nr == _IOC_NR(MTIOCGET)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3740 struct mtget mt_status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3741
^1da177e4c3f41 Linus Torvalds 2005-04-16 3742 if (_IOC_SIZE(cmd_in) != sizeof(struct mtget)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3743 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3744 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3745 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3746
^1da177e4c3f41 Linus Torvalds 2005-04-16 3747 mt_status.mt_type = STp->tape_type;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3748 mt_status.mt_dsreg =
^1da177e4c3f41 Linus Torvalds 2005-04-16 3749 ((STp->block_size << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK) |
^1da177e4c3f41 Linus Torvalds 2005-04-16 3750 ((STp->density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3751 mt_status.mt_blkno = STps->drv_block;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3752 mt_status.mt_fileno = STps->drv_file;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3753 if (STp->block_size != 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3754 if (STps->rw == ST_WRITING)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3755 mt_status.mt_blkno +=
^1da177e4c3f41 Linus Torvalds 2005-04-16 3756 (STp->buffer)->buffer_bytes / STp->block_size;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3757 else if (STps->rw == ST_READING)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3758 mt_status.mt_blkno -=
^1da177e4c3f41 Linus Torvalds 2005-04-16 3759 ((STp->buffer)->buffer_bytes +
^1da177e4c3f41 Linus Torvalds 2005-04-16 3760 STp->block_size - 1) / STp->block_size;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3761 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3762
^1da177e4c3f41 Linus Torvalds 2005-04-16 3763 mt_status.mt_gstat = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3764 if (STp->drv_write_prot)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3765 mt_status.mt_gstat |= GMT_WR_PROT(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3766 if (mt_status.mt_blkno == 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3767 if (mt_status.mt_fileno == 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3768 mt_status.mt_gstat |= GMT_BOT(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3769 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3770 mt_status.mt_gstat |= GMT_EOF(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3771 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3772 mt_status.mt_erreg = (STp->recover_reg << MT_ST_SOFTERR_SHIFT);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3773 mt_status.mt_resid = STp->partition;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3774 if (STps->eof == ST_EOM_OK || STps->eof == ST_EOM_ERROR)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3775 mt_status.mt_gstat |= GMT_EOT(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3776 else if (STps->eof >= ST_EOM_OK)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3777 mt_status.mt_gstat |= GMT_EOD(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3778 if (STp->density == 1)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3779 mt_status.mt_gstat |= GMT_D_800(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3780 else if (STp->density == 2)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3781 mt_status.mt_gstat |= GMT_D_1600(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3782 else if (STp->density == 3)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3783 mt_status.mt_gstat |= GMT_D_6250(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3784 if (STp->ready == ST_READY)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3785 mt_status.mt_gstat |= GMT_ONLINE(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3786 if (STp->ready == ST_NO_TAPE)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3787 mt_status.mt_gstat |= GMT_DR_OPEN(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3788 if (STps->at_sm)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3789 mt_status.mt_gstat |= GMT_SM(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3790 if (STm->do_async_writes ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3791 (STm->do_buffer_writes && STp->block_size != 0) ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3792 STp->drv_buffer != 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3793 mt_status.mt_gstat |= GMT_IM_REP_EN(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3794 if (STp->cleaning_req)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3795 mt_status.mt_gstat |= GMT_CLN(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3796
1207045da5a7c9 Arnd Bergmann 2018-09-07 3797 retval = put_user_mtget(p, &mt_status);
1207045da5a7c9 Arnd Bergmann 2018-09-07 3798 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3799 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3800
^1da177e4c3f41 Linus Torvalds 2005-04-16 3801 STp->recover_reg = 0; /* Clear after read */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3802 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3803 } /* End of MTIOCGET */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3804 if (cmd_type == _IOC_TYPE(MTIOCPOS) && cmd_nr == _IOC_NR(MTIOCPOS)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3805 struct mtpos mt_pos;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3806 if (_IOC_SIZE(cmd_in) != sizeof(struct mtpos)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3807 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3808 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3809 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3810 if ((i = get_location(STp, &blk, &bt, 0)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3811 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3812 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3813 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3814 mt_pos.mt_blkno = blk;
1207045da5a7c9 Arnd Bergmann 2018-09-07 3815 retval = put_user_mtpos(p, &mt_pos);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3816 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3817 }
28f85009e0cf6a Matthias Kaehlcke 2007-07-29 3818 mutex_unlock(&STp->lock);
d320a9551e394c Arnd Bergmann 2019-03-15 3819
dba7688fc9037c Christoph Hellwig 2021-07-24 3820 switch (cmd_in) {
dba7688fc9037c Christoph Hellwig 2021-07-24 3821 case SG_IO:
dba7688fc9037c Christoph Hellwig 2021-07-24 3822 case SCSI_IOCTL_SEND_COMMAND:
dba7688fc9037c Christoph Hellwig 2021-07-24 3823 case CDROM_SEND_PACKET:
dba7688fc9037c Christoph Hellwig 2021-07-24 3824 if (!capable(CAP_SYS_RAWIO))
dba7688fc9037c Christoph Hellwig 2021-07-24 3825 return -EPERM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3826 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3827 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3828 }
dba7688fc9037c Christoph Hellwig 2021-07-24 3829
2e27f576abc6f0 Christoph Hellwig 2021-07-24 @3830 retval = scsi_ioctl(STp->device, STp->disk, file->f_mode, cmd_in, p);
dba7688fc9037c Christoph Hellwig 2021-07-24 3831 if (!retval && cmd_in == SCSI_IOCTL_STOP_UNIT) {
dba7688fc9037c Christoph Hellwig 2021-07-24 3832 /* unload */
dba7688fc9037c Christoph Hellwig 2021-07-24 3833 STp->rew_at_close = 0;
dba7688fc9037c Christoph Hellwig 2021-07-24 3834 STp->ready = ST_NO_TAPE;
dba7688fc9037c Christoph Hellwig 2021-07-24 3835 }
dba7688fc9037c Christoph Hellwig 2021-07-24 3836 return retval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3837
^1da177e4c3f41 Linus Torvalds 2005-04-16 3838 out:
28f85009e0cf6a Matthias Kaehlcke 2007-07-29 3839 mutex_unlock(&STp->lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3840 return retval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3841 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3842
:::::: The code at line 3830 was first introduced by commit
:::::: 2e27f576abc6f056e63ef207b9911b1a04d07020 scsi: scsi_ioctl: Call scsi_cmd_ioctl() from scsi_ioctl()
:::::: TO: Christoph Hellwig <hch(a)lst.de>
:::::: CC: Martin K. Petersen <martin.petersen(a)oracle.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[mcgrof:20210818-add-disk-error-handling-v2 160/160] drivers/lightnvm/core.c:400:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git 20210818-add-disk-error-handling-v2
head: 0517c8bf82eb7da58caada94869afb0957f57c81
commit: 0517c8bf82eb7da58caada94869afb0957f57c81 [160/160] block: add __must_check for *add_disk*() callers
config: hexagon-randconfig-r015-20210818 (attached as .config)
compiler: clang version 12.0.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/commit/?...
git remote add mcgrof https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git
git fetch --no-tags mcgrof 20210818-add-disk-error-handling-v2
git checkout 0517c8bf82eb7da58caada94869afb0957f57c81
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/lightnvm/core.c:400:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
add_disk(tdisk);
^~~~~~~~ ~~~~~
1 warning generated.
vim +/warn_unused_result +400 drivers/lightnvm/core.c
e53927393b9987 Javier González 2018-01-05 304
ade69e2432b795 Matias Bjørling 2017-01-31 305 static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
ade69e2432b795 Matias Bjørling 2017-01-31 306 {
e53927393b9987 Javier González 2018-01-05 307 struct nvm_ioctl_create_extended e;
ade69e2432b795 Matias Bjørling 2017-01-31 308 struct gendisk *tdisk;
ade69e2432b795 Matias Bjørling 2017-01-31 309 struct nvm_tgt_type *tt;
ade69e2432b795 Matias Bjørling 2017-01-31 310 struct nvm_target *t;
ade69e2432b795 Matias Bjørling 2017-01-31 311 struct nvm_tgt_dev *tgt_dev;
ade69e2432b795 Matias Bjørling 2017-01-31 312 void *targetdata;
a14669ebc0e294 Igor Konopko 2019-05-04 313 unsigned int mdts;
8d77bb8276062f Rakesh Pandit 2017-04-20 314 int ret;
ade69e2432b795 Matias Bjørling 2017-01-31 315
e53927393b9987 Javier González 2018-01-05 316 switch (create->conf.type) {
e53927393b9987 Javier González 2018-01-05 317 case NVM_CONFIG_TYPE_SIMPLE:
e53927393b9987 Javier González 2018-01-05 318 ret = __nvm_config_simple(dev, &create->conf.s);
e53927393b9987 Javier González 2018-01-05 319 if (ret)
e53927393b9987 Javier González 2018-01-05 320 return ret;
e53927393b9987 Javier González 2018-01-05 321
e53927393b9987 Javier González 2018-01-05 322 e.lun_begin = create->conf.s.lun_begin;
e53927393b9987 Javier González 2018-01-05 323 e.lun_end = create->conf.s.lun_end;
e53927393b9987 Javier González 2018-01-05 324 e.op = NVM_TARGET_DEFAULT_OP;
e53927393b9987 Javier González 2018-01-05 325 break;
e53927393b9987 Javier González 2018-01-05 326 case NVM_CONFIG_TYPE_EXTENDED:
e53927393b9987 Javier González 2018-01-05 327 ret = __nvm_config_extended(dev, &create->conf.e);
e53927393b9987 Javier González 2018-01-05 328 if (ret)
e53927393b9987 Javier González 2018-01-05 329 return ret;
e53927393b9987 Javier González 2018-01-05 330
e53927393b9987 Javier González 2018-01-05 331 e = create->conf.e;
e53927393b9987 Javier González 2018-01-05 332 break;
e53927393b9987 Javier González 2018-01-05 333 default:
43db059ea4b7e9 Minwoo Im 2019-09-05 334 pr_err("config type not valid\n");
e53927393b9987 Javier González 2018-01-05 335 return -EINVAL;
e53927393b9987 Javier González 2018-01-05 336 }
e53927393b9987 Javier González 2018-01-05 337
e29c80e6dd70d6 Javier González 2018-01-05 338 tt = nvm_find_target_type(create->tgttype);
ade69e2432b795 Matias Bjørling 2017-01-31 339 if (!tt) {
43db059ea4b7e9 Minwoo Im 2019-09-05 340 pr_err("target type %s not found\n", create->tgttype);
ade69e2432b795 Matias Bjørling 2017-01-31 341 return -EINVAL;
ade69e2432b795 Matias Bjørling 2017-01-31 342 }
ade69e2432b795 Matias Bjørling 2017-01-31 343
656e33ca3d4051 Matias Bjørling 2018-10-09 344 if ((tt->flags & NVM_TGT_F_HOST_L2P) != (dev->geo.dom & NVM_RSP_L2P)) {
43db059ea4b7e9 Minwoo Im 2019-09-05 345 pr_err("device is incompatible with target L2P type.\n");
656e33ca3d4051 Matias Bjørling 2018-10-09 346 return -EINVAL;
656e33ca3d4051 Matias Bjørling 2018-10-09 347 }
656e33ca3d4051 Matias Bjørling 2018-10-09 348
bd77b23b40370f Javier González 2018-01-05 349 if (nvm_target_exists(create->tgtname)) {
43db059ea4b7e9 Minwoo Im 2019-09-05 350 pr_err("target name already exists (%s)\n",
bd77b23b40370f Javier González 2018-01-05 351 create->tgtname);
ade69e2432b795 Matias Bjørling 2017-01-31 352 return -EINVAL;
ade69e2432b795 Matias Bjørling 2017-01-31 353 }
ade69e2432b795 Matias Bjørling 2017-01-31 354
e53927393b9987 Javier González 2018-01-05 355 ret = nvm_reserve_luns(dev, e.lun_begin, e.lun_end);
12e9a6d62236da Rakesh Pandit 2017-06-27 356 if (ret)
12e9a6d62236da Rakesh Pandit 2017-06-27 357 return ret;
ade69e2432b795 Matias Bjørling 2017-01-31 358
ade69e2432b795 Matias Bjørling 2017-01-31 359 t = kmalloc(sizeof(struct nvm_target), GFP_KERNEL);
8d77bb8276062f Rakesh Pandit 2017-04-20 360 if (!t) {
8d77bb8276062f Rakesh Pandit 2017-04-20 361 ret = -ENOMEM;
ade69e2432b795 Matias Bjørling 2017-01-31 362 goto err_reserve;
8d77bb8276062f Rakesh Pandit 2017-04-20 363 }
ade69e2432b795 Matias Bjørling 2017-01-31 364
e53927393b9987 Javier González 2018-01-05 365 tgt_dev = nvm_create_tgt_dev(dev, e.lun_begin, e.lun_end, e.op);
ade69e2432b795 Matias Bjørling 2017-01-31 366 if (!tgt_dev) {
43db059ea4b7e9 Minwoo Im 2019-09-05 367 pr_err("could not create target device\n");
8d77bb8276062f Rakesh Pandit 2017-04-20 368 ret = -ENOMEM;
ade69e2432b795 Matias Bjørling 2017-01-31 369 goto err_t;
ade69e2432b795 Matias Bjørling 2017-01-31 370 }
ade69e2432b795 Matias Bjørling 2017-01-31 371
1aabd53a4b49ad Christoph Hellwig 2021-05-21 372 tdisk = blk_alloc_disk(dev->q->node);
8d77bb8276062f Rakesh Pandit 2017-04-20 373 if (!tdisk) {
8d77bb8276062f Rakesh Pandit 2017-04-20 374 ret = -ENOMEM;
7d1ef2f408abec Javier González 2017-04-15 375 goto err_dev;
8d77bb8276062f Rakesh Pandit 2017-04-20 376 }
7d1ef2f408abec Javier González 2017-04-15 377
6eb082452df121 Javier González 2017-04-15 378 strlcpy(tdisk->disk_name, create->tgtname, sizeof(tdisk->disk_name));
ade69e2432b795 Matias Bjørling 2017-01-31 379 tdisk->major = 0;
ade69e2432b795 Matias Bjørling 2017-01-31 380 tdisk->first_minor = 0;
c62b37d96b6eb3 Christoph Hellwig 2020-07-01 381 tdisk->fops = tt->bops;
ade69e2432b795 Matias Bjørling 2017-01-31 382
4af3f75d7992dd Javier González 2017-04-15 383 targetdata = tt->init(tgt_dev, tdisk, create->flags);
8d77bb8276062f Rakesh Pandit 2017-04-20 384 if (IS_ERR(targetdata)) {
8d77bb8276062f Rakesh Pandit 2017-04-20 385 ret = PTR_ERR(targetdata);
ade69e2432b795 Matias Bjørling 2017-01-31 386 goto err_init;
8d77bb8276062f Rakesh Pandit 2017-04-20 387 }
ade69e2432b795 Matias Bjørling 2017-01-31 388
ade69e2432b795 Matias Bjørling 2017-01-31 389 tdisk->private_data = targetdata;
1aabd53a4b49ad Christoph Hellwig 2021-05-21 390 tdisk->queue->queuedata = targetdata;
ade69e2432b795 Matias Bjørling 2017-01-31 391
a14669ebc0e294 Igor Konopko 2019-05-04 392 mdts = (dev->geo.csecs >> 9) * NVM_MAX_VLBA;
a14669ebc0e294 Igor Konopko 2019-05-04 393 if (dev->geo.mdts) {
a14669ebc0e294 Igor Konopko 2019-05-04 394 mdts = min_t(u32, dev->geo.mdts,
e46f4e4822bdec Javier González 2018-03-30 395 (dev->geo.csecs >> 9) * NVM_MAX_VLBA);
a14669ebc0e294 Igor Konopko 2019-05-04 396 }
1aabd53a4b49ad Christoph Hellwig 2021-05-21 397 blk_queue_max_hw_sectors(tdisk->queue, mdts);
ade69e2432b795 Matias Bjørling 2017-01-31 398
ade69e2432b795 Matias Bjørling 2017-01-31 399 set_capacity(tdisk, tt->capacity(targetdata));
ade69e2432b795 Matias Bjørling 2017-01-31 @400 add_disk(tdisk);
ade69e2432b795 Matias Bjørling 2017-01-31 401
8d77bb8276062f Rakesh Pandit 2017-04-20 402 if (tt->sysfs_init && tt->sysfs_init(tdisk)) {
8d77bb8276062f Rakesh Pandit 2017-04-20 403 ret = -ENOMEM;
9a69b0ed6257ae Javier González 2017-01-31 404 goto err_sysfs;
8d77bb8276062f Rakesh Pandit 2017-04-20 405 }
9a69b0ed6257ae Javier González 2017-01-31 406
ade69e2432b795 Matias Bjørling 2017-01-31 407 t->type = tt;
ade69e2432b795 Matias Bjørling 2017-01-31 408 t->disk = tdisk;
ade69e2432b795 Matias Bjørling 2017-01-31 409 t->dev = tgt_dev;
ade69e2432b795 Matias Bjørling 2017-01-31 410
ade69e2432b795 Matias Bjørling 2017-01-31 411 mutex_lock(&dev->mlock);
ade69e2432b795 Matias Bjørling 2017-01-31 412 list_add_tail(&t->list, &dev->targets);
ade69e2432b795 Matias Bjørling 2017-01-31 413 mutex_unlock(&dev->mlock);
ade69e2432b795 Matias Bjørling 2017-01-31 414
900148296b78c6 Rakesh Pandit 2017-10-13 415 __module_get(tt->owner);
900148296b78c6 Rakesh Pandit 2017-10-13 416
ade69e2432b795 Matias Bjørling 2017-01-31 417 return 0;
9a69b0ed6257ae Javier González 2017-01-31 418 err_sysfs:
9a69b0ed6257ae Javier González 2017-01-31 419 if (tt->exit)
a7c9e9109ca114 Javier González 2018-06-01 420 tt->exit(targetdata, true);
ade69e2432b795 Matias Bjørling 2017-01-31 421 err_init:
1aabd53a4b49ad Christoph Hellwig 2021-05-21 422 blk_cleanup_disk(tdisk);
ade69e2432b795 Matias Bjørling 2017-01-31 423 err_dev:
edee1bdd66bf0f Javier González 2017-04-15 424 nvm_remove_tgt_dev(tgt_dev, 0);
ade69e2432b795 Matias Bjørling 2017-01-31 425 err_t:
ade69e2432b795 Matias Bjørling 2017-01-31 426 kfree(t);
ade69e2432b795 Matias Bjørling 2017-01-31 427 err_reserve:
e53927393b9987 Javier González 2018-01-05 428 nvm_release_luns_err(dev, e.lun_begin, e.lun_end);
8d77bb8276062f Rakesh Pandit 2017-04-20 429 return ret;
ade69e2432b795 Matias Bjørling 2017-01-31 430 }
ade69e2432b795 Matias Bjørling 2017-01-31 431
:::::: The code at line 400 was first introduced by commit
:::::: ade69e2432b795c76653e1dfa09c684549826a50 lightnvm: merge gennvm with core
:::::: TO: Matias Bjørling <matias(a)cnexlabs.com>
:::::: CC: Jens Axboe <axboe(a)fb.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
Re: [PATCH V2 7/7] blk-mq: build default queue map via group_cpus_evenly()
by kernel test robot
Hi Ming,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/irq/core]
[also build test ERROR on next-20210818]
[cannot apply to block/for-next linux/master linus/master v5.14-rc6]
[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/Ming-Lei/genirq-affinity-abstrac...
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 04c2721d3530f0723b4c922a8fa9f26b202a20de
config: x86_64-randconfig-c002-20210818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/5ef5858ae062865d3941a9fc8d6ef0240...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ming-Lei/genirq-affinity-abstract-new-API-from-managed-irq-affinity-spread/20210818-173646
git checkout 5ef5858ae062865d3941a9fc8d6ef024068b36dd
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
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 >>):
ld: block/blk-mq-cpumap.o: in function `blk_mq_map_queues':
>> block/blk-mq-cpumap.c:24: undefined reference to `group_cpus_evenly'
vim +24 block/blk-mq-cpumap.c
18
19 int blk_mq_map_queues(struct blk_mq_queue_map *qmap)
20 {
21 const struct cpumask *masks;
22 unsigned int queue, cpu;
23
> 24 masks = group_cpus_evenly(qmap->nr_queues);
25 if (!masks)
26 goto fallback;
27
28 for (queue = 0; queue < qmap->nr_queues; queue++) {
29 for_each_cpu(cpu, &masks[queue])
30 qmap->mq_map[cpu] = qmap->queue_offset + queue;
31 }
32 kfree(masks);
33 return 0;
34 fallback:
35 for_each_possible_cpu(cpu)
36 qmap->mq_map[cpu] = qmap->queue_offset;
37 return 0;
38 }
39 EXPORT_SYMBOL_GPL(blk_mq_map_queues);
40
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[kees:kspp/array-bounds/next-20210816/v1 7/10] drivers/net/can/usb/etas_es58x/es581_4.c:374:60: error: subscripted value is neither array nor pointer nor vector
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git kspp/array-bounds/next-20210816/v1
head: b07d5e8190ca172b1ffddd1412b921296000b379
commit: 3b3fe3f0ff785b437a70e29fd96037e46972968a [7/10] treewide: Replace open-coded flex arrays in unions
config: x86_64-randconfig-a003-20210816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id...
git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
git fetch --no-tags kees kspp/array-bounds/next-20210816/v1
git checkout 3b3fe3f0ff785b437a70e29fd96037e46972968a
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
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/net/can/usb/etas_es58x/es581_4.c: In function 'es581_4_tx_can_msg':
>> drivers/net/can/usb/etas_es58x/es581_4.c:374:60: error: subscripted value is neither array nor pointer nor vector
374 | tx_can_msg = (typeof(tx_can_msg))&es581_4_urb_cmd->raw_msg[msg_len];
| ^
vim +374 drivers/net/can/usb/etas_es58x/es581_4.c
1dfb6005a60b13 Vincent Mailhol 2021-04-10 342
1dfb6005a60b13 Vincent Mailhol 2021-04-10 343 static int es581_4_tx_can_msg(struct es58x_priv *priv,
1dfb6005a60b13 Vincent Mailhol 2021-04-10 344 const struct sk_buff *skb)
1dfb6005a60b13 Vincent Mailhol 2021-04-10 345 {
1dfb6005a60b13 Vincent Mailhol 2021-04-10 346 struct es58x_device *es58x_dev = priv->es58x_dev;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 347 union es58x_urb_cmd *urb_cmd = priv->tx_urb->transfer_buffer;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 348 struct es581_4_urb_cmd *es581_4_urb_cmd = &urb_cmd->es581_4_urb_cmd;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 349 struct can_frame *cf = (struct can_frame *)skb->data;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 350 struct es581_4_tx_can_msg *tx_can_msg;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 351 u16 msg_len;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 352 int ret;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 353
1dfb6005a60b13 Vincent Mailhol 2021-04-10 354 if (can_is_canfd_skb(skb))
1dfb6005a60b13 Vincent Mailhol 2021-04-10 355 return -EMSGSIZE;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 356
1dfb6005a60b13 Vincent Mailhol 2021-04-10 357 if (priv->tx_can_msg_cnt == 0) {
7fcecf51c18fa7 Vincent Mailhol 2021-06-29 358 msg_len = sizeof(es581_4_urb_cmd->bulk_tx_can_msg.num_can_msg);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 359 es581_4_fill_urb_header(urb_cmd, ES581_4_CAN_COMMAND_TYPE,
1dfb6005a60b13 Vincent Mailhol 2021-04-10 360 ES581_4_CMD_ID_TX_MSG,
1dfb6005a60b13 Vincent Mailhol 2021-04-10 361 priv->channel_idx, msg_len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 362 es581_4_urb_cmd->bulk_tx_can_msg.num_can_msg = 0;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 363 } else {
1dfb6005a60b13 Vincent Mailhol 2021-04-10 364 msg_len = es581_4_get_msg_len(urb_cmd);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 365 }
1dfb6005a60b13 Vincent Mailhol 2021-04-10 366
1dfb6005a60b13 Vincent Mailhol 2021-04-10 367 ret = es58x_check_msg_max_len(es58x_dev->dev,
1dfb6005a60b13 Vincent Mailhol 2021-04-10 368 es581_4_urb_cmd->bulk_tx_can_msg,
1dfb6005a60b13 Vincent Mailhol 2021-04-10 369 msg_len + sizeof(*tx_can_msg));
1dfb6005a60b13 Vincent Mailhol 2021-04-10 370 if (ret)
1dfb6005a60b13 Vincent Mailhol 2021-04-10 371 return ret;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 372
1dfb6005a60b13 Vincent Mailhol 2021-04-10 373 /* Fill message contents. */
f4f5247daa45ee Vincent Mailhol 2021-06-29 @374 tx_can_msg = (typeof(tx_can_msg))&es581_4_urb_cmd->raw_msg[msg_len];
1dfb6005a60b13 Vincent Mailhol 2021-04-10 375 put_unaligned_le32(es58x_get_raw_can_id(cf), &tx_can_msg->can_id);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 376 put_unaligned_le32(priv->tx_head, &tx_can_msg->packet_idx);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 377 put_unaligned_le16((u16)es58x_get_flags(skb), &tx_can_msg->flags);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 378 tx_can_msg->channel_no = priv->channel_idx + ES581_4_CHANNEL_IDX_OFFSET;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 379 tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 380
1dfb6005a60b13 Vincent Mailhol 2021-04-10 381 memcpy(tx_can_msg->data, cf->data, cf->len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 382
1dfb6005a60b13 Vincent Mailhol 2021-04-10 383 /* Calculate new sizes. */
1dfb6005a60b13 Vincent Mailhol 2021-04-10 384 es581_4_urb_cmd->bulk_tx_can_msg.num_can_msg++;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 385 msg_len += es581_4_sizeof_rx_tx_msg(*tx_can_msg);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 386 priv->tx_urb->transfer_buffer_length = es58x_get_urb_cmd_len(es58x_dev,
1dfb6005a60b13 Vincent Mailhol 2021-04-10 387 msg_len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 388 es581_4_urb_cmd->msg_len = cpu_to_le16(msg_len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10 389
1dfb6005a60b13 Vincent Mailhol 2021-04-10 390 return 0;
1dfb6005a60b13 Vincent Mailhol 2021-04-10 391 }
1dfb6005a60b13 Vincent Mailhol 2021-04-10 392
:::::: The code at line 374 was first introduced by commit
:::::: f4f5247daa45eef07b1779195fa8d65f19c2eb5f can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to increase readability
:::::: TO: Vincent Mailhol <mailhol.vincent(a)wanadoo.fr>
:::::: CC: Marc Kleine-Budde <mkl(a)pengutronix.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[kees:kspp/array-bounds/next-20210816/v1 9/10] drivers/scsi/megaraid.c:211:13: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'u8[15]' {aka 'unsigned char[15]'}
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git kspp/array-bounds/next-20210816/v1
head: b07d5e8190ca172b1ffddd1412b921296000b379
commit: ecc23a9ee765008e439113eea38fb1cbbd3d7c83 [9/10] Makefile: Enable -Warray-bounds
config: arc-randconfig-r043-20210818 (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id...
git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
git fetch --no-tags kees kspp/array-bounds/next-20210816/v1
git checkout ecc23a9ee765008e439113eea38fb1cbbd3d7c83
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/scsi/megaraid.c: In function 'mega_query_adapter':
>> drivers/scsi/megaraid.c:211:13: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'u8[15]' {aka 'unsigned char[15]'} [-Warray-bounds]
211 | mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
| ^~
drivers/scsi/megaraid.c:195:17: note: while referencing 'raw_mbox'
195 | u8 raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
drivers/scsi/megaraid.c:265:21: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'u8[15]' {aka 'unsigned char[15]'} [-Warray-bounds]
265 | mbox->m_out.xferaddr = prod_info_dma_handle;
| ^~
drivers/scsi/megaraid.c:195:17: note: while referencing 'raw_mbox'
195 | u8 raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
drivers/scsi/megaraid.c:235:21: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'u8[15]' {aka 'unsigned char[15]'} [-Warray-bounds]
235 | mbox->m_out.xferaddr = (u32)dma_handle;
| ^~
drivers/scsi/megaraid.c:195:17: note: while referencing 'raw_mbox'
195 | u8 raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
drivers/scsi/megaraid.c:238:21: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'u8[15]' {aka 'unsigned char[15]'} [-Warray-bounds]
238 | mbox->m_out.cmd = MEGA_MBOXCMD_ADPEXTINQ;
| ^~
drivers/scsi/megaraid.c:195:17: note: while referencing 'raw_mbox'
195 | u8 raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
>> drivers/scsi/megaraid.c:3881:30: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'unsigned char[15]' [-Warray-bounds]
3881 | mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/megaraid.c:3872:25: note: while referencing 'raw_mbox'
3872 | unsigned char raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
drivers/scsi/megaraid.c: In function 'megaraid_probe_one':
drivers/scsi/megaraid.c:3585:30: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'unsigned char[15]' [-Warray-bounds]
3585 | mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/megaraid.c:3576:25: note: while referencing 'raw_mbox'
3576 | unsigned char raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
drivers/scsi/megaraid.c:3623:30: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'unsigned char[15]' [-Warray-bounds]
3623 | mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/megaraid.c:3607:23: note: while referencing 'raw_mbox'
3607 | unsigned char raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
drivers/scsi/megaraid.c:3678:30: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'unsigned char[15]' [-Warray-bounds]
3678 | mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/megaraid.c:3662:25: note: while referencing 'raw_mbox'
3662 | unsigned char raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
drivers/scsi/megaraid.c:3926:30: warning: array subscript 'mbox_t[0]' is partly outside array bounds of 'unsigned char[15]' [-Warray-bounds]
3926 | mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/megaraid.c:3917:25: note: while referencing 'raw_mbox'
3917 | unsigned char raw_mbox[sizeof(struct mbox_out)];
| ^~~~~~~~
--
drivers/thunderbolt/xdomain.c: In function 'tb_xdomain_properties_changed':
>> drivers/thunderbolt/xdomain.c:226:22: warning: array subscript 'const struct tb_xdp_error_response[0]' is partly outside array bounds of 'struct tb_xdp_properties_changed_response[1]' [-Warray-bounds]
226 | switch (error->error) {
| ~~~~~^~~~~~~
drivers/thunderbolt/xdomain.c:448:51: note: while referencing 'res'
448 | struct tb_xdp_properties_changed_response res;
| ^~~
--
drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_get_adjust_request_post_cursor':
>> drivers/gpu/drm/drm_dp_helper.c:59:27: warning: array subscript 10 is outside array bounds of 'const u8[6]' {aka 'const unsigned char[6]'} [-Warray-bounds]
59 | return link_status[r - DP_LANE0_1_STATUS];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:133:51: note: while referencing 'link_status'
133 | u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_pcon_dsc_bpp_incr':
drivers/gpu/drm/drm_dp_helper.c:2981:28: warning: array subscript 12 is outside array bounds of 'const u8[12]' {aka 'const unsigned char[12]'} [-Warray-bounds]
2981 | buf = pcon_dsc_dpcd[DP_PCON_DSC_BPP_INCR - DP_PCON_DSC_ENCODER];
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:2977:39: note: while referencing 'pcon_dsc_dpcd'
2977 | int drm_dp_pcon_dsc_bpp_incr(const u8 pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE])
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from net/mac80211/tx.c:15:
net/mac80211/tx.c: In function 'ieee80211_xmit_fast':
>> include/linux/skbuff.h:2048:9: warning: array subscript 'struct sk_buff[0]' is partly outside array bounds of 'struct ieee80211_tx_data[1]' [-Warray-bounds]
2048 | __skb_insert(newsk, next->prev, next, list);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/tx.c:3506:34: note: while referencing 'tx'
3506 | struct ieee80211_tx_data tx;
| ^~
--
In file included from include/linux/if_ether.h:19,
from net/mac80211/ieee80211_i.h:16,
from net/mac80211/mesh.h:13,
from net/mac80211/mesh_ps.c:7:
net/mac80211/mesh_ps.c: In function 'mps_frame_deliver':
>> include/linux/skbuff.h:2048:9: warning: array subscript 'struct sk_buff[0]' is partly outside array bounds of 'struct sk_buff_head[1]' [-Warray-bounds]
2048 | __skb_insert(newsk, next->prev, next, list);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/mesh_ps.c:454:29: note: while referencing 'frames'
454 | struct sk_buff_head frames;
| ^~~~~~
In file included from include/linux/if_ether.h:19,
from net/mac80211/ieee80211_i.h:16,
from net/mac80211/mesh.h:13,
from net/mac80211/mesh_ps.c:7:
>> include/linux/skbuff.h:2048:9: warning: array subscript 'struct sk_buff[0]' is partly outside array bounds of 'struct sk_buff_head[1]' [-Warray-bounds]
2048 | __skb_insert(newsk, next->prev, next, list);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/mesh_ps.c:454:29: note: while referencing 'frames'
454 | struct sk_buff_head frames;
| ^~~~~~
--
In file included from include/linux/if_ether.h:19,
from include/linux/etherdevice.h:20,
from net/mac80211/sta_info.c:12:
net/mac80211/sta_info.c: In function 'ieee80211_sta_ps_deliver_response':
>> include/linux/skbuff.h:2048:9: warning: array subscript 'struct sk_buff[0]' is partly outside array bounds of 'struct sk_buff_head[1]' [-Warray-bounds]
2048 | __skb_insert(newsk, next->prev, next, list);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/sta_info.c:1577:29: note: while referencing 'frames'
1577 | struct sk_buff_head frames;
| ^~~~~~
In file included from include/linux/if_ether.h:19,
from include/linux/etherdevice.h:20,
from net/mac80211/sta_info.c:12:
>> include/linux/skbuff.h:2048:9: warning: array subscript 'struct sk_buff[0]' is partly outside array bounds of 'struct sk_buff_head[1]' [-Warray-bounds]
2048 | __skb_insert(newsk, next->prev, next, list);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/sta_info.c:1620:37: note: while referencing 'pending'
1620 | struct sk_buff_head pending;
| ^~~~~~~
vim +211 drivers/scsi/megaraid.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 181
^1da177e4c3f41 Linus Torvalds 2005-04-16 182
^1da177e4c3f41 Linus Torvalds 2005-04-16 183 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 184 * mega_query_adapter()
^1da177e4c3f41 Linus Torvalds 2005-04-16 185 * @adapter - pointer to our soft state
^1da177e4c3f41 Linus Torvalds 2005-04-16 186 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 187 * Issue the adapter inquiry commands to the controller and find out
^1da177e4c3f41 Linus Torvalds 2005-04-16 188 * information and parameter about the devices attached
^1da177e4c3f41 Linus Torvalds 2005-04-16 189 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 190 static int
^1da177e4c3f41 Linus Torvalds 2005-04-16 191 mega_query_adapter(adapter_t *adapter)
^1da177e4c3f41 Linus Torvalds 2005-04-16 192 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 193 dma_addr_t prod_info_dma_handle;
^1da177e4c3f41 Linus Torvalds 2005-04-16 194 mega_inquiry3 *inquiry3;
^1da177e4c3f41 Linus Torvalds 2005-04-16 195 u8 raw_mbox[sizeof(struct mbox_out)];
^1da177e4c3f41 Linus Torvalds 2005-04-16 196 mbox_t *mbox;
^1da177e4c3f41 Linus Torvalds 2005-04-16 197 int retval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 198
^1da177e4c3f41 Linus Torvalds 2005-04-16 199 /* Initialize adapter inquiry mailbox */
^1da177e4c3f41 Linus Torvalds 2005-04-16 200
^1da177e4c3f41 Linus Torvalds 2005-04-16 201 mbox = (mbox_t *)raw_mbox;
^1da177e4c3f41 Linus Torvalds 2005-04-16 202
^1da177e4c3f41 Linus Torvalds 2005-04-16 203 memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 204 memset(&mbox->m_out, 0, sizeof(raw_mbox));
^1da177e4c3f41 Linus Torvalds 2005-04-16 205
^1da177e4c3f41 Linus Torvalds 2005-04-16 206 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 207 * Try to issue Inquiry3 command
^1da177e4c3f41 Linus Torvalds 2005-04-16 208 * if not succeeded, then issue MEGA_MBOXCMD_ADAPTERINQ command and
^1da177e4c3f41 Linus Torvalds 2005-04-16 209 * update enquiry3 structure
^1da177e4c3f41 Linus Torvalds 2005-04-16 210 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 @211 mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
^1da177e4c3f41 Linus Torvalds 2005-04-16 212
^1da177e4c3f41 Linus Torvalds 2005-04-16 213 inquiry3 = (mega_inquiry3 *)adapter->mega_buffer;
^1da177e4c3f41 Linus Torvalds 2005-04-16 214
^1da177e4c3f41 Linus Torvalds 2005-04-16 215 raw_mbox[0] = FC_NEW_CONFIG; /* i.e. mbox->cmd=0xA1 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 216 raw_mbox[2] = NC_SUBOP_ENQUIRY3; /* i.e. 0x0F */
^1da177e4c3f41 Linus Torvalds 2005-04-16 217 raw_mbox[3] = ENQ3_GET_SOLICITED_FULL; /* i.e. 0x02 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 218
^1da177e4c3f41 Linus Torvalds 2005-04-16 219 /* Issue a blocking command to the card */
^1da177e4c3f41 Linus Torvalds 2005-04-16 220 if ((retval = issue_scb_block(adapter, raw_mbox))) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 221 /* the adapter does not support 40ld */
^1da177e4c3f41 Linus Torvalds 2005-04-16 222
^1da177e4c3f41 Linus Torvalds 2005-04-16 223 mraid_ext_inquiry *ext_inq;
^1da177e4c3f41 Linus Torvalds 2005-04-16 224 mraid_inquiry *inq;
^1da177e4c3f41 Linus Torvalds 2005-04-16 225 dma_addr_t dma_handle;
^1da177e4c3f41 Linus Torvalds 2005-04-16 226
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 227 ext_inq = dma_alloc_coherent(&adapter->dev->dev,
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 228 sizeof(mraid_ext_inquiry),
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 229 &dma_handle, GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 230
^1da177e4c3f41 Linus Torvalds 2005-04-16 231 if( ext_inq == NULL ) return -1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 232
^1da177e4c3f41 Linus Torvalds 2005-04-16 233 inq = &ext_inq->raid_inq;
^1da177e4c3f41 Linus Torvalds 2005-04-16 234
^1da177e4c3f41 Linus Torvalds 2005-04-16 235 mbox->m_out.xferaddr = (u32)dma_handle;
^1da177e4c3f41 Linus Torvalds 2005-04-16 236
^1da177e4c3f41 Linus Torvalds 2005-04-16 237 /*issue old 0x04 command to adapter */
^1da177e4c3f41 Linus Torvalds 2005-04-16 238 mbox->m_out.cmd = MEGA_MBOXCMD_ADPEXTINQ;
^1da177e4c3f41 Linus Torvalds 2005-04-16 239
^1da177e4c3f41 Linus Torvalds 2005-04-16 240 issue_scb_block(adapter, raw_mbox);
^1da177e4c3f41 Linus Torvalds 2005-04-16 241
^1da177e4c3f41 Linus Torvalds 2005-04-16 242 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 243 * update Enquiry3 and ProductInfo structures with
^1da177e4c3f41 Linus Torvalds 2005-04-16 244 * mraid_inquiry structure
^1da177e4c3f41 Linus Torvalds 2005-04-16 245 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 246 mega_8_to_40ld(inq, inquiry3,
^1da177e4c3f41 Linus Torvalds 2005-04-16 247 (mega_product_info *)&adapter->product_info);
^1da177e4c3f41 Linus Torvalds 2005-04-16 248
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 249 dma_free_coherent(&adapter->dev->dev,
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 250 sizeof(mraid_ext_inquiry), ext_inq,
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 251 dma_handle);
^1da177e4c3f41 Linus Torvalds 2005-04-16 252
^1da177e4c3f41 Linus Torvalds 2005-04-16 253 } else { /*adapter supports 40ld */
^1da177e4c3f41 Linus Torvalds 2005-04-16 254 adapter->flag |= BOARD_40LD;
^1da177e4c3f41 Linus Torvalds 2005-04-16 255
^1da177e4c3f41 Linus Torvalds 2005-04-16 256 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 257 * get product_info, which is static information and will be
^1da177e4c3f41 Linus Torvalds 2005-04-16 258 * unchanged
^1da177e4c3f41 Linus Torvalds 2005-04-16 259 */
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 260 prod_info_dma_handle = dma_map_single(&adapter->dev->dev,
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 261 (void *)&adapter->product_info,
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 262 sizeof(mega_product_info),
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 263 DMA_FROM_DEVICE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 264
^1da177e4c3f41 Linus Torvalds 2005-04-16 265 mbox->m_out.xferaddr = prod_info_dma_handle;
^1da177e4c3f41 Linus Torvalds 2005-04-16 266
^1da177e4c3f41 Linus Torvalds 2005-04-16 267 raw_mbox[0] = FC_NEW_CONFIG; /* i.e. mbox->cmd=0xA1 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 268 raw_mbox[2] = NC_SUBOP_PRODUCT_INFO; /* i.e. 0x0E */
^1da177e4c3f41 Linus Torvalds 2005-04-16 269
^1da177e4c3f41 Linus Torvalds 2005-04-16 270 if ((retval = issue_scb_block(adapter, raw_mbox)))
3b8a1ba378b750 Bjorn Helgaas 2015-07-07 271 dev_warn(&adapter->dev->dev,
3b8a1ba378b750 Bjorn Helgaas 2015-07-07 272 "Product_info cmd failed with error: %d\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 273 retval);
^1da177e4c3f41 Linus Torvalds 2005-04-16 274
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 275 dma_unmap_single(&adapter->dev->dev, prod_info_dma_handle,
ec090ef8cd1c23 Suraj Upadhyay 2020-07-29 276 sizeof(mega_product_info), DMA_FROM_DEVICE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 277 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 278
^1da177e4c3f41 Linus Torvalds 2005-04-16 279
^1da177e4c3f41 Linus Torvalds 2005-04-16 280 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 281 * kernel scans the channels from 0 to <= max_channel
^1da177e4c3f41 Linus Torvalds 2005-04-16 282 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 283 adapter->host->max_channel =
^1da177e4c3f41 Linus Torvalds 2005-04-16 284 adapter->product_info.nchannels + NVIRT_CHAN -1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 285
^1da177e4c3f41 Linus Torvalds 2005-04-16 286 adapter->host->max_id = 16; /* max targets per channel */
^1da177e4c3f41 Linus Torvalds 2005-04-16 287
^1da177e4c3f41 Linus Torvalds 2005-04-16 288 adapter->host->max_lun = 7; /* Up to 7 luns for non disk devices */
^1da177e4c3f41 Linus Torvalds 2005-04-16 289
^1da177e4c3f41 Linus Torvalds 2005-04-16 290 adapter->host->cmd_per_lun = max_cmd_per_lun;
^1da177e4c3f41 Linus Torvalds 2005-04-16 291
^1da177e4c3f41 Linus Torvalds 2005-04-16 292 adapter->numldrv = inquiry3->num_ldrv;
^1da177e4c3f41 Linus Torvalds 2005-04-16 293
^1da177e4c3f41 Linus Torvalds 2005-04-16 294 adapter->max_cmds = adapter->product_info.max_commands;
^1da177e4c3f41 Linus Torvalds 2005-04-16 295
^1da177e4c3f41 Linus Torvalds 2005-04-16 296 if(adapter->max_cmds > MAX_COMMANDS)
^1da177e4c3f41 Linus Torvalds 2005-04-16 297 adapter->max_cmds = MAX_COMMANDS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 298
^1da177e4c3f41 Linus Torvalds 2005-04-16 299 adapter->host->can_queue = adapter->max_cmds - 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 300
^1da177e4c3f41 Linus Torvalds 2005-04-16 301 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 302 * Get the maximum number of scatter-gather elements supported by this
^1da177e4c3f41 Linus Torvalds 2005-04-16 303 * firmware
^1da177e4c3f41 Linus Torvalds 2005-04-16 304 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 305 mega_get_max_sgl(adapter);
^1da177e4c3f41 Linus Torvalds 2005-04-16 306
^1da177e4c3f41 Linus Torvalds 2005-04-16 307 adapter->host->sg_tablesize = adapter->sglen;
^1da177e4c3f41 Linus Torvalds 2005-04-16 308
124dd90f6525ee Adam Radford 2012-01-10 309 /* use HP firmware and bios version encoding
124dd90f6525ee Adam Radford 2012-01-10 310 Note: fw_version[0|1] and bios_version[0|1] were originally shifted
124dd90f6525ee Adam Radford 2012-01-10 311 right 8 bits making them zero. This 0 value was hardcoded to fix
124dd90f6525ee Adam Radford 2012-01-10 312 sparse warnings. */
54ebfd57813ada Jon Mason 2012-07-10 313 if (adapter->product_info.subsysvid == PCI_VENDOR_ID_HP) {
875826a71c8b5e Arnd Bergmann 2017-07-14 314 snprintf(adapter->fw_version, sizeof(adapter->fw_version),
875826a71c8b5e Arnd Bergmann 2017-07-14 315 "%c%d%d.%d%d",
^1da177e4c3f41 Linus Torvalds 2005-04-16 316 adapter->product_info.fw_version[2],
124dd90f6525ee Adam Radford 2012-01-10 317 0,
^1da177e4c3f41 Linus Torvalds 2005-04-16 318 adapter->product_info.fw_version[1] & 0x0f,
124dd90f6525ee Adam Radford 2012-01-10 319 0,
^1da177e4c3f41 Linus Torvalds 2005-04-16 320 adapter->product_info.fw_version[0] & 0x0f);
875826a71c8b5e Arnd Bergmann 2017-07-14 321 snprintf(adapter->bios_version, sizeof(adapter->fw_version),
875826a71c8b5e Arnd Bergmann 2017-07-14 322 "%c%d%d.%d%d",
^1da177e4c3f41 Linus Torvalds 2005-04-16 323 adapter->product_info.bios_version[2],
124dd90f6525ee Adam Radford 2012-01-10 324 0,
^1da177e4c3f41 Linus Torvalds 2005-04-16 325 adapter->product_info.bios_version[1] & 0x0f,
124dd90f6525ee Adam Radford 2012-01-10 326 0,
^1da177e4c3f41 Linus Torvalds 2005-04-16 327 adapter->product_info.bios_version[0] & 0x0f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 328 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 329 memcpy(adapter->fw_version,
^1da177e4c3f41 Linus Torvalds 2005-04-16 330 (char *)adapter->product_info.fw_version, 4);
^1da177e4c3f41 Linus Torvalds 2005-04-16 331 adapter->fw_version[4] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 332
^1da177e4c3f41 Linus Torvalds 2005-04-16 333 memcpy(adapter->bios_version,
^1da177e4c3f41 Linus Torvalds 2005-04-16 334 (char *)adapter->product_info.bios_version, 4);
^1da177e4c3f41 Linus Torvalds 2005-04-16 335
^1da177e4c3f41 Linus Torvalds 2005-04-16 336 adapter->bios_version[4] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 337 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 338
3b8a1ba378b750 Bjorn Helgaas 2015-07-07 339 dev_notice(&adapter->dev->dev, "[%s:%s] detected %d logical drives\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 340 adapter->fw_version, adapter->bios_version, adapter->numldrv);
^1da177e4c3f41 Linus Torvalds 2005-04-16 341
^1da177e4c3f41 Linus Torvalds 2005-04-16 342 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 343 * Do we support extended (>10 bytes) cdbs
^1da177e4c3f41 Linus Torvalds 2005-04-16 344 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 345 adapter->support_ext_cdb = mega_support_ext_cdb(adapter);
^1da177e4c3f41 Linus Torvalds 2005-04-16 346 if (adapter->support_ext_cdb)
3b8a1ba378b750 Bjorn Helgaas 2015-07-07 347 dev_notice(&adapter->dev->dev, "supports extended CDBs\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 348
^1da177e4c3f41 Linus Torvalds 2005-04-16 349
^1da177e4c3f41 Linus Torvalds 2005-04-16 350 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 351 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 352
:::::: The code at line 211 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds(a)ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds(a)ppc970.osdl.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
Re: [PATCH V2] raid1: ensure write behind bio has less than BIO_MAX_VECS sectors
by kernel test robot
Hi Guoqing,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on song-md/md-next]
[also build test ERROR on v5.14-rc6 next-20210818]
[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/Guoqing-Jiang/raid1-ensure-write...
base: git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next
config: x86_64-randconfig-a011-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d2b574a4dea5b718e4386bf2e26af0126e5978ce)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/abf22557456363eb6fd1d1d09332f5261...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Guoqing-Jiang/raid1-ensure-write-behind-bio-has-less-than-BIO_MAX_VECS-sectors/20210818-154106
git checkout abf22557456363eb6fd1d1d09332f5261d61796c
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/md/
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/md/raid1.c:1388:30: error: use of undeclared identifier 'mirror'
if (test_bit(WriteMostly, &mirror->rdev->flags))
^
drivers/md/raid1.c:1471:56: error: use of undeclared identifier 'PAGE_SECTORS'
max_sectors = min_t(int, max_sectors, BIO_MAX_VECS * PAGE_SECTORS);
^
drivers/md/raid1.c:1471:56: error: use of undeclared identifier 'PAGE_SECTORS'
3 errors generated.
vim +/mirror +1388 drivers/md/raid1.c
1320
1321 static void raid1_write_request(struct mddev *mddev, struct bio *bio,
1322 int max_write_sectors)
1323 {
1324 struct r1conf *conf = mddev->private;
1325 struct r1bio *r1_bio;
1326 int i, disks;
1327 struct bitmap *bitmap = mddev->bitmap;
1328 unsigned long flags;
1329 struct md_rdev *blocked_rdev;
1330 struct blk_plug_cb *cb;
1331 struct raid1_plug_cb *plug = NULL;
1332 int first_clone;
1333 int max_sectors;
1334 bool write_behind = false;
1335
1336 if (mddev_is_clustered(mddev) &&
1337 md_cluster_ops->area_resyncing(mddev, WRITE,
1338 bio->bi_iter.bi_sector, bio_end_sector(bio))) {
1339
1340 DEFINE_WAIT(w);
1341 for (;;) {
1342 prepare_to_wait(&conf->wait_barrier,
1343 &w, TASK_IDLE);
1344 if (!md_cluster_ops->area_resyncing(mddev, WRITE,
1345 bio->bi_iter.bi_sector,
1346 bio_end_sector(bio)))
1347 break;
1348 schedule();
1349 }
1350 finish_wait(&conf->wait_barrier, &w);
1351 }
1352
1353 /*
1354 * Register the new request and wait if the reconstruction
1355 * thread has put up a bar for new requests.
1356 * Continue immediately if no resync is active currently.
1357 */
1358 wait_barrier(conf, bio->bi_iter.bi_sector);
1359
1360 r1_bio = alloc_r1bio(mddev, bio);
1361 r1_bio->sectors = max_write_sectors;
1362
1363 if (conf->pending_count >= max_queued_requests) {
1364 md_wakeup_thread(mddev->thread);
1365 raid1_log(mddev, "wait queued");
1366 wait_event(conf->wait_barrier,
1367 conf->pending_count < max_queued_requests);
1368 }
1369 /* first select target devices under rcu_lock and
1370 * inc refcount on their rdev. Record them by setting
1371 * bios[x] to bio
1372 * If there are known/acknowledged bad blocks on any device on
1373 * which we have seen a write error, we want to avoid writing those
1374 * blocks.
1375 * This potentially requires several writes to write around
1376 * the bad blocks. Each set of writes gets it's own r1bio
1377 * with a set of bios attached.
1378 */
1379
1380 disks = conf->raid_disks * 2;
1381 retry_write:
1382 blocked_rdev = NULL;
1383 rcu_read_lock();
1384 max_sectors = r1_bio->sectors;
1385 for (i = 0; i < disks; i++) {
1386 struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev);
1387
> 1388 if (test_bit(WriteMostly, &mirror->rdev->flags))
1389 write_behind = true;
1390
1391 if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) {
1392 atomic_inc(&rdev->nr_pending);
1393 blocked_rdev = rdev;
1394 break;
1395 }
1396 r1_bio->bios[i] = NULL;
1397 if (!rdev || test_bit(Faulty, &rdev->flags)) {
1398 if (i < conf->raid_disks)
1399 set_bit(R1BIO_Degraded, &r1_bio->state);
1400 continue;
1401 }
1402
1403 atomic_inc(&rdev->nr_pending);
1404 if (test_bit(WriteErrorSeen, &rdev->flags)) {
1405 sector_t first_bad;
1406 int bad_sectors;
1407 int is_bad;
1408
1409 is_bad = is_badblock(rdev, r1_bio->sector, max_sectors,
1410 &first_bad, &bad_sectors);
1411 if (is_bad < 0) {
1412 /* mustn't write here until the bad block is
1413 * acknowledged*/
1414 set_bit(BlockedBadBlocks, &rdev->flags);
1415 blocked_rdev = rdev;
1416 break;
1417 }
1418 if (is_bad && first_bad <= r1_bio->sector) {
1419 /* Cannot write here at all */
1420 bad_sectors -= (r1_bio->sector - first_bad);
1421 if (bad_sectors < max_sectors)
1422 /* mustn't write more than bad_sectors
1423 * to other devices yet
1424 */
1425 max_sectors = bad_sectors;
1426 rdev_dec_pending(rdev, mddev);
1427 /* We don't set R1BIO_Degraded as that
1428 * only applies if the disk is
1429 * missing, so it might be re-added,
1430 * and we want to know to recover this
1431 * chunk.
1432 * In this case the device is here,
1433 * and the fact that this chunk is not
1434 * in-sync is recorded in the bad
1435 * block log
1436 */
1437 continue;
1438 }
1439 if (is_bad) {
1440 int good_sectors = first_bad - r1_bio->sector;
1441 if (good_sectors < max_sectors)
1442 max_sectors = good_sectors;
1443 }
1444 }
1445 r1_bio->bios[i] = bio;
1446 }
1447 rcu_read_unlock();
1448
1449 if (unlikely(blocked_rdev)) {
1450 /* Wait for this device to become unblocked */
1451 int j;
1452
1453 for (j = 0; j < i; j++)
1454 if (r1_bio->bios[j])
1455 rdev_dec_pending(conf->mirrors[j].rdev, mddev);
1456 r1_bio->state = 0;
1457 allow_barrier(conf, bio->bi_iter.bi_sector);
1458 raid1_log(mddev, "wait rdev %d blocked", blocked_rdev->raid_disk);
1459 md_wait_for_blocked_rdev(blocked_rdev, mddev);
1460 wait_barrier(conf, bio->bi_iter.bi_sector);
1461 goto retry_write;
1462 }
1463
1464 /*
1465 * When using a bitmap, we may call alloc_behind_master_bio below.
1466 * alloc_behind_master_bio allocates a copy of the data payload a page
1467 * at a time and thus needs a new bio that can fit the whole payload
1468 * this bio in page sized chunks.
1469 */
1470 if (write_behind && bitmap)
1471 max_sectors = min_t(int, max_sectors, BIO_MAX_VECS * PAGE_SECTORS);
1472 if (max_sectors < bio_sectors(bio)) {
1473 struct bio *split = bio_split(bio, max_sectors,
1474 GFP_NOIO, &conf->bio_split);
1475 bio_chain(split, bio);
1476 submit_bio_noacct(bio);
1477 bio = split;
1478 r1_bio->master_bio = bio;
1479 r1_bio->sectors = max_sectors;
1480 }
1481
1482 if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
1483 r1_bio->start_time = bio_start_io_acct(bio);
1484 atomic_set(&r1_bio->remaining, 1);
1485 atomic_set(&r1_bio->behind_remaining, 0);
1486
1487 first_clone = 1;
1488
1489 for (i = 0; i < disks; i++) {
1490 struct bio *mbio = NULL;
1491 struct md_rdev *rdev = conf->mirrors[i].rdev;
1492 if (!r1_bio->bios[i])
1493 continue;
1494
1495 if (first_clone) {
1496 /* do behind I/O ?
1497 * Not if there are too many, or cannot
1498 * allocate memory, or a reader on WriteMostly
1499 * is waiting for behind writes to flush */
1500 if (bitmap &&
1501 (atomic_read(&bitmap->behind_writes)
1502 < mddev->bitmap_info.max_write_behind) &&
1503 !waitqueue_active(&bitmap->behind_wait)) {
1504 alloc_behind_master_bio(r1_bio, bio);
1505 }
1506
1507 md_bitmap_startwrite(bitmap, r1_bio->sector, r1_bio->sectors,
1508 test_bit(R1BIO_BehindIO, &r1_bio->state));
1509 first_clone = 0;
1510 }
1511
1512 if (r1_bio->behind_master_bio)
1513 mbio = bio_clone_fast(r1_bio->behind_master_bio,
1514 GFP_NOIO, &mddev->bio_set);
1515 else
1516 mbio = bio_clone_fast(bio, GFP_NOIO, &mddev->bio_set);
1517
1518 if (r1_bio->behind_master_bio) {
1519 if (test_bit(CollisionCheck, &rdev->flags))
1520 wait_for_serialization(rdev, r1_bio);
1521 if (test_bit(WriteMostly, &rdev->flags))
1522 atomic_inc(&r1_bio->behind_remaining);
1523 } else if (mddev->serialize_policy)
1524 wait_for_serialization(rdev, r1_bio);
1525
1526 r1_bio->bios[i] = mbio;
1527
1528 mbio->bi_iter.bi_sector = (r1_bio->sector +
1529 conf->mirrors[i].rdev->data_offset);
1530 bio_set_dev(mbio, conf->mirrors[i].rdev->bdev);
1531 mbio->bi_end_io = raid1_end_write_request;
1532 mbio->bi_opf = bio_op(bio) | (bio->bi_opf & (REQ_SYNC | REQ_FUA));
1533 if (test_bit(FailFast, &conf->mirrors[i].rdev->flags) &&
1534 !test_bit(WriteMostly, &conf->mirrors[i].rdev->flags) &&
1535 conf->raid_disks - mddev->degraded > 1)
1536 mbio->bi_opf |= MD_FAILFAST;
1537 mbio->bi_private = r1_bio;
1538
1539 atomic_inc(&r1_bio->remaining);
1540
1541 if (mddev->gendisk)
1542 trace_block_bio_remap(mbio, disk_devt(mddev->gendisk),
1543 r1_bio->sector);
1544 /* flush_pending_writes() needs access to the rdev so...*/
1545 mbio->bi_bdev = (void *)conf->mirrors[i].rdev;
1546
1547 cb = blk_check_plugged(raid1_unplug, mddev, sizeof(*plug));
1548 if (cb)
1549 plug = container_of(cb, struct raid1_plug_cb, cb);
1550 else
1551 plug = NULL;
1552 if (plug) {
1553 bio_list_add(&plug->pending, mbio);
1554 plug->pending_cnt++;
1555 } else {
1556 spin_lock_irqsave(&conf->device_lock, flags);
1557 bio_list_add(&conf->pending_bio_list, mbio);
1558 conf->pending_count++;
1559 spin_unlock_irqrestore(&conf->device_lock, flags);
1560 md_wakeup_thread(mddev->thread);
1561 }
1562 }
1563
1564 r1_bio_write_done(r1_bio);
1565
1566 /* In case raid1d snuck in to freeze_array */
1567 wake_up(&conf->wait_barrier);
1568 }
1569
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
Re: [RFC net-next 5/7] selftests/net: Add test app for SIOC{S|G}SYNCE
by kernel test robot
Hi Arkadiusz,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on aba1e4adb54e020d3ca85a4df3ef0f8febe87548]
url: https://github.com/0day-ci/linux/commits/Arkadiusz-Kubalewski/Add-basic-S...
base: aba1e4adb54e020d3ca85a4df3ef0f8febe87548
config: x86_64-rhel-8.3-kselftests (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/615235c3d363d0d6f520b487b655349b5...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Arkadiusz-Kubalewski/Add-basic-SyncE-interfaces/20210817-001938
git checkout 615235c3d363d0d6f520b487b655349b56e3d15f
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
phy_ref_clk.c: In function 'main':
>> phy_ref_clk.c:125:26: warning: format '%u' expects argument of type 'unsigned int *', but argument 3 has type '__u8 *' {aka 'unsigned char *'} [-Wformat=]
125 | ret = sscanf(argv[2], "%u", &pin);
| ~^ ~~~~
| | |
| | __u8 * {aka unsigned char *}
| unsigned int *
| %hhu
>> phy_ref_clk.c:132:27: warning: format '%u' expects argument of type 'unsigned int *', but argument 3 has type '_Bool *' [-Wformat=]
132 | ret = sscanf(argv[3], "%u", &enable);
| ~^ ~~~~~~~
| | |
| | _Bool *
| unsigned int *
In function 'get_ref_clk',
inlined from 'main' at phy_ref_clk.c:130:9:
>> phy_ref_clk.c:58:2: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
58 | strncpy(ifdata.ifr_name, ifname, IFNAMSIZ);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[mcgrof-next:20210817-add-disk-error-handling-next 1/89] drivers/nvme/host/core.c:3760:29: error: 'NVME_QUIRK_LIGHTNVM' undeclared; did you mean 'NVME_NS_LIGHTNVM'?
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210817-add-disk-error-handling-next
head: 3d00c210d7fd616243af9cf41829f4a56f116ba8
commit: 6e8cedeeaa2d0b259010b0d956020ba8284196ce [1/89] nvme: use blk_mq_alloc_disk
config: arc-randconfig-r043-20210816 (attached as .config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/com...
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210817-add-disk-error-handling-next
git checkout 6e8cedeeaa2d0b259010b0d956020ba8284196ce
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/nvme/host/
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/nvme/host/core.c: In function 'nvme_alloc_ns':
>> drivers/nvme/host/core.c:3760:29: error: 'NVME_QUIRK_LIGHTNVM' undeclared (first use in this function); did you mean 'NVME_NS_LIGHTNVM'?
3760 | if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
| ^~~~~~~~~~~~~~~~~~~
| NVME_NS_LIGHTNVM
drivers/nvme/host/core.c:3760:29: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/nvme/host/core.c:3761:21: error: implicit declaration of function 'nvme_nvm_register'; did you mean 'nvme_pr_register'? [-Werror=implicit-function-declaration]
3761 | if (nvme_nvm_register(ns, disk->disk_name, node)) {
| ^~~~~~~~~~~~~~~~~
| nvme_pr_register
cc1: some warnings being treated as errors
vim +3760 drivers/nvme/host/core.c
3710
3711 static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
3712 struct nvme_ns_ids *ids)
3713 {
3714 struct nvme_ns *ns;
3715 struct gendisk *disk;
3716 struct nvme_id_ns *id;
3717 int node = ctrl->numa_node;
3718
3719 if (nvme_identify_ns(ctrl, nsid, ids, &id))
3720 return;
3721
3722 ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node);
3723 if (!ns)
3724 goto out_free_id;
3725
3726 disk = blk_mq_alloc_disk(ctrl->tagset, ns);
3727 if (IS_ERR(disk))
3728 goto out_free_ns;
3729 disk->fops = &nvme_bdev_ops;
3730 disk->private_data = ns;
3731
3732 ns->disk = disk;
3733 ns->queue = disk->queue;
3734
3735 if (ctrl->opts && ctrl->opts->data_digest)
3736 blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue);
3737
3738 blk_queue_flag_set(QUEUE_FLAG_NONROT, ns->queue);
3739 if (ctrl->ops->flags & NVME_F_PCI_P2PDMA)
3740 blk_queue_flag_set(QUEUE_FLAG_PCI_P2PDMA, ns->queue);
3741
3742 ns->ctrl = ctrl;
3743 kref_init(&ns->kref);
3744
3745 if (nvme_init_ns_head(ns, nsid, ids, id->nmic & NVME_NS_NMIC_SHARED))
3746 goto out_cleanup_disk;
3747
3748 /*
3749 * Without the multipath code enabled, multiple controller per
3750 * subsystems are visible as devices and thus we cannot use the
3751 * subsystem instance.
3752 */
3753 if (!nvme_mpath_set_disk_name(ns, disk->disk_name, &disk->flags))
3754 sprintf(disk->disk_name, "nvme%dn%d", ctrl->instance,
3755 ns->head->instance);
3756
3757 if (nvme_update_ns_info(ns, id))
3758 goto out_unlink_ns;
3759
> 3760 if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
> 3761 if (nvme_nvm_register(ns, disk->disk_name, node)) {
3762 dev_warn(ctrl->device, "LightNVM init failure\n");
3763 goto out_unlink_ns;
3764 }
3765 }
3766
3767 down_write(&ctrl->namespaces_rwsem);
3768 list_add_tail(&ns->list, &ctrl->namespaces);
3769 up_write(&ctrl->namespaces_rwsem);
3770
3771 nvme_get_ctrl(ctrl);
3772
3773 device_add_disk(ctrl->device, ns->disk, nvme_ns_id_attr_groups);
3774 if (!nvme_ns_head_multipath(ns->head))
3775 nvme_add_ns_cdev(ns);
3776
3777 nvme_mpath_add_disk(ns, id);
3778 nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name);
3779 kfree(id);
3780
3781 return;
3782
3783 out_unlink_ns:
3784 mutex_lock(&ctrl->subsys->lock);
3785 list_del_rcu(&ns->siblings);
3786 if (list_empty(&ns->head->list))
3787 list_del_init(&ns->head->entry);
3788 mutex_unlock(&ctrl->subsys->lock);
3789 nvme_put_ns_head(ns->head);
3790 out_cleanup_disk:
3791 blk_cleanup_disk(disk);
3792 out_free_ns:
3793 kfree(ns);
3794 out_free_id:
3795 kfree(id);
3796 }
3797
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month