Skip to content

Commit

Permalink
Staging: vt6655-6: shift wrap in hostap_set_encryption()
Browse files Browse the repository at this point in the history
abySeq is an unsigned char so shifting more than 31 bits will lead to a
shift wrapping bug.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Oct 22, 2012
1 parent ff4573a commit c25015c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/vt6655/hostap.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,9 @@ static int hostap_set_encryption(PSDevice pDevice,

if (param->u.crypt.seq) {
memcpy(&abySeq, param->u.crypt.seq, 8);
for (ii = 0 ; ii < 8 ; ii++) {
KeyRSC |= (abySeq[ii] << (ii * 8));
}
for (ii = 0 ; ii < 8 ; ii++)
KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8);

dwKeyIndex |= 1 << 29;
pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/vt6656/hostap.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,9 @@ static int hostap_set_encryption(PSDevice pDevice,

if (param->u.crypt.seq) {
memcpy(&abySeq, param->u.crypt.seq, 8);
for (ii = 0 ; ii < 8 ; ii++) {
KeyRSC |= (abySeq[ii] << (ii * 8));
}
for (ii = 0 ; ii < 8 ; ii++)
KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8);

dwKeyIndex |= 1 << 29;
pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC;
}
Expand Down

0 comments on commit c25015c

Please sign in to comment.