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

Re: [XEN PATCH v2 3/3] xen: fix violations of MISRA C:2012 Rule 3.1





On 19/06/23 12:29, Jan Beulich wrote:
On 19.06.2023 11:56, Nicola Vetrini wrote:
--- a/xen/common/xmalloc_tlsf.c
+++ b/xen/common/xmalloc_tlsf.c
@@ -140,9 +140,6 @@ static inline void MAPPING_SEARCH(unsigned long *r, int 
*fl, int *sl)
          *fl = flsl(*r) - 1;
          *sl = (*r >> (*fl - MAX_LOG2_SLI)) - MAX_SLI;
          *fl -= FLI_OFFSET;
-        /*if ((*fl -= FLI_OFFSET) < 0) // FL will be always >0!
-         *fl = *sl = 0;
-         */
          *r &= ~t;
      }
  }

As indicated before, I don't think simply dropping the commented out code
is appropriate here. Personally I'd prefer if it was kept (using #if/#else),
but I'd also be okay with replacing it by a respective assertion. That said,
if other maintainers think this is the way to go, then I don't mean to
stand in the way.


As Andrew Cooper suggested in the previous patch revision (https://lore.kernel.org/xen-devel/6bac57d5-c30e-f763-3abe-b3f335f366f7@xxxxxxxx/T/#m5722285215bb30d7f1202b9921e2c92d5ea98d6a), I removed the commented-out code, since it contains unused logic, but I would be okay with replacing it with an assertion, if you think it's better.

Regards,

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



 


Rackspace

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