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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1446316993.2757.222.camel@perches.com>
Date:	Sat, 31 Oct 2015 11:43:13 -0700
From:	Joe Perches <joe@...ches.com>
To:	Bogicevic Sasa <brutallesale@...il.com>
Cc:	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers:staging:gdm72xx Fix line over 80 characters

On Sat, 2015-10-31 at 18:14 +0100, Bogicevic Sasa wrote:
> On 10/31, Joe Perches wrote:
> >On Sat, 2015-10-31 at 17:38 +0100, Bogicevic Sasa wrote:
> >> This fixes line over 80 character messages from checkpatch.pl
> >[]
> >> diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c
> >[]
> >> @@ -382,7 +382,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
> >>
> >>  		spin_lock_irqsave(&qcb->qos_lock, flags);
> >>  		qcb->csr[index].sfid = sfid;
> >> -		qcb->csr[index].classifier_rule_en = ((buf[pos++] << 8) & 0xff00);
> >> +		qcb->csr[index].classifier_rule_en = (buf[pos++] << 8) & 0xff00;
> >>  		qcb->csr[index].classifier_rule_en += buf[pos++];
> >>  		if (qcb->csr[index].classifier_rule_en == 0)
> >>  			qcb->qos_null_idx = index;
> >
> >If you do this one, please do all of them in the
> >same block.
> >
> >		qcb->csr[index].srcport_lo = ((buf[pos++]<<8)&0xff00);
> >		qcb->csr[index].srcport_lo += buf[pos++];
> >		qcb->csr[index].srcport_hi = ((buf[pos++]<<8)&0xff00);
> >		qcb->csr[index].srcport_hi += buf[pos++];
> >		qcb->csr[index].dstport_lo = ((buf[pos++]<<8)&0xff00);
> >		qcb->csr[index].dstport_lo += buf[pos++];
> >		qcb->csr[index].dstport_hi = ((buf[pos++]<<8)&0xff00);
> >
> >It'd probably be nicer to use a temporary for
> >qcb->csr[index] too.
> >
> >Also, the += is kind of odd.  These are really a
> >le16_to_cpu conversion, so it might be nicer to use
> >that mechanism.
> >
> >	csr->srcport_lo = get_unaligned_le16(&buf[pos]);
> >	pos += 2;
> >
> >
> It is not a problem to remove unnecesarry brackets but bear in mind I am
> new to bitwise stuff.

No worries, it's not that obvious.

>  So how it should be, like this?
> 
> 		qcb->csr[index].srcport_lo = get_unaligned_le16(&buf[pos]);
> 		pos += 2;
> 		qcb->csr[index].srcport_lo = buf[pos];

No, it'd be:

		csr->srcport_lo = get_unaligned_le16(&buf[pos]);
		pos += 2;
		csr->srcport_hi = get_unaligned_le16(&buf[pos]);
		pos += 2;
		csr->dstport_lo = get_unaligned_le16(&buf[pos]);
		pos += 2;
		csr->dstport_hi = get_unaligned_le16(&buf[pos]);
		pos += 2;


--
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