X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fstaging%2Fwlan-ng%2Fprism2fw.c;fp=kernel%2Fdrivers%2Fstaging%2Fwlan-ng%2Fprism2fw.c;h=8fc80df0b53ef59735f9ff0417522efb0d4f2d46;hb=e09b41010ba33a20a87472ee821fa407a5b8da36;hp=9408644cc8b8734551fcf20b22da53e21f76f47f;hpb=f93b97fd65072de626c074dbe099a1fff05ce060;p=kvmfornfv.git diff --git a/kernel/drivers/staging/wlan-ng/prism2fw.c b/kernel/drivers/staging/wlan-ng/prism2fw.c index 9408644cc..8fc80df0b 100644 --- a/kernel/drivers/staging/wlan-ng/prism2fw.c +++ b/kernel/drivers/staging/wlan-ng/prism2fw.c @@ -584,13 +584,12 @@ static int mkimage(struct imgchunk *clist, unsigned int *ccnt) ----------------------------------------------------------------*/ static int mkpdrlist(struct pda *pda) { - int result = 0; u16 *pda16 = (u16 *) pda->buf; int curroff; /* in 'words' */ pda->nrec = 0; curroff = 0; - while (curroff < (HFA384x_PDA_LEN_MAX / 2) && + while (curroff < (HFA384x_PDA_LEN_MAX / 2 - 1) && le16_to_cpu(pda16[curroff + 1]) != HFA384x_PDR_END_OF_PDA) { pda->rec[pda->nrec] = (hfa384x_pdrec_t *) &(pda16[curroff]); @@ -626,16 +625,14 @@ static int mkpdrlist(struct pda *pda) curroff += le16_to_cpu(pda16[curroff]) + 1; } - if (curroff >= (HFA384x_PDA_LEN_MAX / 2)) { + if (curroff >= (HFA384x_PDA_LEN_MAX / 2 - 1)) { pr_err("no end record found or invalid lengths in PDR data, exiting. %x %d\n", curroff, pda->nrec); return 1; } - if (le16_to_cpu(pda16[curroff + 1]) == HFA384x_PDR_END_OF_PDA) { - pda->rec[pda->nrec] = (hfa384x_pdrec_t *) &(pda16[curroff]); - (pda->nrec)++; - } - return result; + pda->rec[pda->nrec] = (hfa384x_pdrec_t *) &(pda16[curroff]); + (pda->nrec)++; + return 0; } /*---------------------------------------------------------------- @@ -708,7 +705,10 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, continue; } - /* Validate plug address against chunk data and identify chunk */ + /* + * Validate plug address against + * chunk data and identify chunk + */ for (c = 0; c < nfchunks; c++) { cstart = fchunk[c].addr; cend = fchunk[c].addr + fchunk[c].len; @@ -923,7 +923,8 @@ static int read_fwfile(const struct ihex_binrec *record) rcnt, s3info[ns3info].len, s3info[ns3info].type); - if (((s3info[ns3info].len - 1) * sizeof(u16)) > sizeof(s3info[ns3info].info)) { + if (((s3info[ns3info].len - 1) * sizeof(u16)) > + sizeof(s3info[ns3info].info)) { pr_err("S3 inforec length too long - aborting\n"); return 1; }