[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 21/25] s390x/sclp: Use size_t in process_mdb()
Since it is unlikely we have sizeof(mdbo->mto.message) < 0, we can convert this variable to an unsigned type. Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx> --- hw/char/sclpconsole-lm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 49543e2c83..48c76d863e 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -208,7 +208,7 @@ static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len) static int process_mdb(SCLPEvent *event, MDBO *mdbo) { int rc; - int len; + uint16_t len; uint8_t buffer[SIZE_BUFFER]; const size_t hlen = sizeof(mdbo->length) + sizeof(mdbo->type) @@ -217,6 +217,7 @@ static int process_mdb(SCLPEvent *event, MDBO *mdbo) + sizeof(mdbo->mto._reserved); len = be16_to_cpu(mdbo->length); + assert(len >= hlen); len -= hlen; assert(len <= SIZE_BUFFER); -- 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |