> Complain from coverity: > usbredir-0.7.1/usbredirhost/usbredirhost.c:1159: sign_extension: > Suspicious implicit sign extension: "max_packetsize" with type > "unsigned short" (16 bits, unsigned) is promoted in > "pkts_per_transfer * transfer_count * max_packetsize" to type "int" > (32 bits, signed), then sign-extended to type "unsigned long" > (64 bits, unsigned). If "pkts_per_transfer * transfer_count * > max_packetsize" is greater than 0x7FFFFFFF, the upper bits of the > result will all be 1. > > Pretty sure that reaching 0x7FFFFFFF is improbable but let's make > coverity happy. > --- > usbredirhost/usbredirhost.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c > index 2b3ee74..22c5e39 100644 > --- a/usbredirhost/usbredirhost.c > +++ b/usbredirhost/usbredirhost.c > @@ -1156,7 +1156,9 @@ static void usbredirhost_stop_stream(struct > usbredirhost *host, > static void usbredirhost_set_iso_threshold(struct usbredirhost *host, > uint8_t pkts_per_transfer, uint8_t transfer_count, uint16_t > max_packetsize) > { > - uint64_t reference = pkts_per_transfer * transfer_count * > max_packetsize; > + uint64_t reference = (size_t) (pkts_per_transfer * transfer_count); > + reference *= (size_t) max_packetsize; > + You could just convert the first factor to "unsigned int". > host->iso_threshold.lower = reference / 2; > host->iso_threshold.higher = reference * 3; > DEBUG("higher threshold is %" PRIu64 " bytes | lower threshold is %" > PRIu64 " bytes", Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel