From: Dan Carpenter <dan.carpenter@oracle.com>
To: hans.verkuil@cisco.com
Cc: linux-media@vger.kernel.org
Subject: [bug report] [media] cec-funcs.h: static inlines to pack/unpack CEC messages
Date: Tue, 5 Jul 2016 19:42:19 +0300 [thread overview]
Message-ID: <20160705164219.GA12369@mwanda> (raw)
Hello Hans Verkuil,
The patch 50f7d5a65e5a: "[media] cec-funcs.h: static inlines to
pack/unpack CEC messages" from Jun 17, 2016, leads to the following
static checker warning:
include/linux/cec-funcs.h:1154 cec_ops_set_osd_string()
warn: setting length 'msg->len - 3' to negative one
include/linux/cec-funcs.h
1150 static inline void cec_ops_set_osd_string(const struct cec_msg *msg,
1151 __u8 *disp_ctl,
1152 char *osd)
1153 {
1154 unsigned int len = msg->len - 3;
The reason for this warning is that we know msg->len is at least 2 but
this code assumes it is at least 3. There is a check in
cec_received_msg() which ensures that it is not <= 1.
1155
1156 *disp_ctl = msg->msg[2];
1157 if (len > 13)
1158 len = 13;
1159 memcpy(osd, msg->msg + 3, len);
1160 osd[len] = '\0';
1161 }
regards,
dan carpenter
reply other threads:[~2016-07-05 16:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20160705164219.GA12369@mwanda \
--to=dan.carpenter@oracle.com \
--cc=hans.verkuil@cisco.com \
--cc=linux-media@vger.kernel.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