From: Dan Carpenter <dan.carpenter@oracle.com>
To: leoli@freescale.com
Cc: linuxppc-dev@lists.ozlabs.org
Subject: re: [POWERPC] Add QUICC Engine (QE) infrastructure
Date: Wed, 6 Jan 2016 12:27:15 +0300 [thread overview]
Message-ID: <20160106092715.GA23148@mwanda> (raw)
Hello Li Yang,
The patch 986585385131: "[POWERPC] Add QUICC Engine (QE)
infrastructure" from Oct 3, 2006, leads to the following static
checker warning:
drivers/soc/fsl/qe/qe_ic.c:412 qe_ic_set_priority()
error: buffer overflow 'qe_ic_info' 44 <= 127
drivers/soc/fsl/qe/qe_ic.c
401 /* Set Priority level within its group, from 1 to 8 */
402 int qe_ic_set_priority(unsigned int virq, unsigned int priority)
403 {
404 struct qe_ic *qe_ic = qe_ic_from_irq(virq);
405 unsigned int src = virq_to_hw(virq);
406 u32 temp;
407
408 if (priority > 8 || priority == 0)
409 return -EINVAL;
410 if (src > 127)
The 127 isn't right here, I'm not sure where that value comes from. It
should be >= ARRAY_SIZE(qe_ic_info).
411 return -EINVAL;
412 if (qe_ic_info[src].pri_reg == 0)
413 return -EINVAL;
414
415 temp = qe_ic_read(qe_ic->regs, qe_ic_info[src].pri_reg);
416
417 if (priority < 4) {
418 temp &= ~(0x7 << (32 - priority * 3));
419 temp |= qe_ic_info[src].pri_code << (32 - priority * 3);
420 } else {
421 temp &= ~(0x7 << (24 - priority * 3));
422 temp |= qe_ic_info[src].pri_code << (24 - priority * 3);
423 }
424
425 qe_ic_write(qe_ic->regs, qe_ic_info[src].pri_reg, temp);
426
427 return 0;
428 }
regards,
dan carpenter
next reply other threads:[~2016-01-06 9:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 9:27 Dan Carpenter [this message]
2016-01-18 9:22 ` [POWERPC] Add QUICC Engine (QE) infrastructure Li Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160106092715.GA23148@mwanda \
--to=dan.carpenter@oracle.com \
--cc=leoli@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).