Re: [PATCH 1/1] block: add default clause for unsupported T10_PI types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/21/19 4:00 PM, Max Gurtovoy wrote:
> kbuild robot reported the following warning:
> 
> block/t10-pi.c: In function 't10_pi_verify':
> block/t10-pi.c:62:3: warning: enumeration value 'T10_PI_TYPE0_PROTECTION'
>                       not handled in switch [-Wswitch]
>        switch (type) {
>        ^~~~~~

This commit message is woefully lacking. It doesn't explain anything...?
Why aren't we just flagging this as an error? Seems a lot saner than adding
a BUG().


diff --git a/block/t10-pi.c b/block/t10-pi.c
index 0c0120a672f9..6a1d4128a9d4 100644
--- a/block/t10-pi.c
+++ b/block/t10-pi.c
@@ -79,6 +79,10 @@ static blk_status_t t10_pi_verify(struct blk_integrity_iter *iter,
 			    pi->ref_tag == T10_PI_REF_ESCAPE)
 				goto next;
 			break;
+		default:
+			pr_err("%s: unsupported protection type: %d\n",
+						iter->disk_name, type);
+			return BLK_STS_PROTECTION;
 		}
 
 		csum = fn(iter->data_buf, iter->interval);

-- 
Jens Axboe




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux