lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130913204354.GA20782@redhat.com>
Date:	Fri, 13 Sep 2013 16:43:54 -0400
From:	Dave Jones <davej@...hat.com>
To:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:	nab@...erainc.com
Subject: Re: target: Add support for EXTENDED_COPY copy offload emulation

On Fri, Sep 13, 2013 at 12:01:21AM +0000, Linux Kernel wrote:
 > Gitweb:     http://git.kernel.org/linus/;a=commit;h=cbf031f425fd0b30ff10ba83b612753189a6bbbf
 > Commit:     cbf031f425fd0b30ff10ba83b612753189a6bbbf
 > Parent:     89c12cc925a7d0982dc53b743a42108acc76aef4
 > Author:     Nicholas Bellinger <nab@...erainc.com>
 > AuthorDate: Tue Aug 20 15:38:55 2013 -0700
 > Committer:  Nicholas Bellinger <nab@...ux-iscsi.org>
 > CommitDate: Tue Sep 10 16:48:43 2013 -0700
 > 
 >     target: Add support for EXTENDED_COPY copy offload emulation

...

 > +static int target_xcopy_parse_segdesc_02(struct se_cmd *se_cmd, struct xcopy_op *xop,
 > +					unsigned char *p)
 > +{
 > +	unsigned char *desc = p;
 > +	int dc = (desc[1] & 0x02);
 > +	unsigned short desc_len;
 > +
 > +	desc_len = get_unaligned_be16(&desc[2]);
 > +	if (desc_len != 0x18) {
 > +		pr_err("XCOPY segment desc 0x02: Illegal desc_len:"
 > +				" %hu\n", desc_len);
 > +		return -EINVAL;
 > +	}
 > +
 > +	xop->stdi = get_unaligned_be16(&desc[4]);
 > +	xop->dtdi = get_unaligned_be16(&desc[6]);
 > +	pr_debug("XCOPY seg desc 0x02: desc_len: %hu stdi: %hu dtdi: %hu, DC: %d\n",
 > +		desc_len, xop->stdi, xop->dtdi, dc);
 > +
 > +	xop->nolb = get_unaligned_be16(&desc[10]);
 > +	xop->src_lba = get_unaligned_be64(&desc[12]);
 > +	xop->dst_lba = get_unaligned_be64(&desc[20]);
 > +	pr_debug("XCOPY seg desc 0x02: nolb: %hu src_lba: %llu dst_lba: %llu\n",
 > +		xop->nolb, (unsigned long long)xop->src_lba,
 > +		(unsigned long long)xop->dst_lba);
 > +
 > +	if (dc != 0) {
 > +		xop->dbl = (desc[29] << 16) & 0xff;
 > +		xop->dbl |= (desc[30] << 8) & 0xff;
 > +		xop->dbl |= desc[31] & 0xff;
 > +
 > +		pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl);
 > +	}
 > +	return 0;
 > +}

Coverity picked up a new warning in this code.
It notes that (desc[30] << 8) & 0xff is always zero.

Did you want

 	xop->dbl = (desc[29] >> 16) & 0xff;

instead maybe ?

The << 16 looks suspect too, though it didn't warn on that.

	Dave


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ