[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v3 15/15] xen: fix violations of MISRA C:2012 Rule 7.2


  • To: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 12 Jul 2023 12:59:18 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3mhO9XPSu9CQySCs0dqtRatUFWGeHo7Qth9MqNNK4FU=; b=YIz7riKW//pI6nMfsmTkt/qCJL6jyAXadGugy0WZUImQwa1WmqpFQDs6/V8Hbr3rv0/bBODVrseCy2AOgevAjjEuDJqtt1TR728G9ZzEEPNtPfEnUNYymCvLyDVBddheRM2+IegSxkoe8Grjqde4Mw3zXoIGPVF059n/7QwwOfuIQwkHXu4Bb3oKPDCkXPlN3UPitZ2nMs2sSxV+fcQuc/yJ/npJkj7o0UAbgSFTT4Cf4gfW5Ti1jga7ZqNxREzOplxVt7qiEiGUT9C3ClmM3zFBhkw2vCvjT3LeeSKeACmlpXK2v8UJM819cFxE/3ATame5fK6havC3bgqvCxiYgg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hPW+j7P8W4En8zUbAAz4f50vLBpnAXZ7rEyyVn0w5q5HvnggI3vEcVOZup3AMPwQuT714UvZf481IhftMjBvmibTK8sPR3lLjxihVpZoHyirthw6zb+zMkyVjonYxjj5Grra5N9uwcuwICnrnWPX/KkJ5ILCVa8MnmeLlzBBNiD+NtvNVMda0yFB+ja+OAh6OdaIUMBoqGU5N4rI6rfWk3JJ8qDXf4n4ARMxiFwT2oXRxBE6edbbo+6ctvC4WxFp6rNokZYnj6v1206j5sK04rXYVWAnlylUhWLcLd60AEYa+UMytJ56qcyV3H9MMiTEUlZgFdNa/HuYb8Add2aoPA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Xenia Ragiadakou <Xenia.Ragiadakou@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 12 Jul 2023 10:59:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.07.2023 12:32, Simone Ballarin wrote:
> From: Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>
> 
> The xen sources contains violations of MISRA C:2012 Rule 7.2 whose
> headline states:
> "A 'u' or 'U' suffix shall be applied to all integer constants
> that are represented in an unsigned type".
> 
> Add the 'U' suffix to integers literals with unsigned type.
> 
> Fot the sake of uniformity, the following changes are made:
> - add the 'U' suffix to all integer constants before the
>   '?' operator in 'bitops.h'
> 
> Signed-off-by: Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>
> Signed-off-by: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
with ...

> --- a/xen/lib/muldiv64.c
> +++ b/xen/lib/muldiv64.c
> @@ -27,7 +27,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
>      rh = (uint64_t)u.l.high * (uint64_t)b;
>      rh += (rl >> 32);
>      res.l.high = rh / c;
> -    res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c;
> +    res.l.low = (((rh % c) << 32) + ((uint32_t)rl)) / c;

... the excess pair of parentheses here dropped (which I'll do while
committing).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.