Unverified Commit 9ef5a47c authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12685 block: fix potential invalid pointer dereference in blk_add_partition

parents 8da7093d 06381006
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -705,9 +705,11 @@ static bool blk_add_partition(struct gendisk *disk, struct block_device *bdev,

	part = add_partition(disk, p, from, size, state->parts[p].flags,
			     &state->parts[p].info);
	if (IS_ERR(part) && PTR_ERR(part) != -ENXIO) {
	if (IS_ERR(part)) {
		if (PTR_ERR(part) != -ENXIO) {
			printk(KERN_ERR " %s: p%d could not be added: %ld\n",
			       disk->disk_name, p, -PTR_ERR(part));
		}
		return true;
	}