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

Re: [Minios-devel] [UNIKRAFT PATCH] lib/ukdebug: Separate condition string from format in UK_ASSERT, UK_WARNIF


  • To: minios-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Sat, 12 May 2018 11:32:38 +0300
  • Delivery-date: Sat, 12 May 2018 08:32:47 +0000
  • Ironport-phdr: 9a23:v2M4GRcQ1up4Ci84u/3j6C3SlGMj4u6mDksu8pMizoh2WeGdxcu8Yx7h7PlgxGXEQZ/co6odzbaO6Oa4ASQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTahb75+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYeRWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZTAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hycdLzM37X/ZisJwgqxYrhyuqRNwzIzIb4+aL/d+YqHQcMkGSWZdUMtcVSpMCZ68YYsVCOoBOP5Vopf6p1sVsRu+BA+sD/7pxD9Vnn/2wLAx3uM9HgHBxwwgA9MOsHLOoNXxKacSSf21wbLUwjXYdf9WwSr955PSfhA7pvGBRLR9etfSx0k3Dw7Jk1qdpZH/Mz6W1ukBqXaX4/RiWO61hWMrsxx9rzusy8s2lIXEhJgZx1LZ+SljwYs4K9u1Q1Nhb9G+CptfrSSaOpNzQsMlXm5npj43yqYDuZ6nZCgKz4knxwLHZ/yHbYeI5hXjWf6PITd9nn1leba/iwyu/ki70OH8TtS0301QoipfldnArnEN1xrN5cibUvZx40is1SuV2w3Q6uxIO144mbTZJpI7zLM8jp8Tvl7CHi/ylkX2lqiWdkA89+e07OTneanmpp6aN4NujgH+L7wumtGkDOskKQgCRXCb+fmn27H55035R61GjucqnanBrJDaOcMbq7a8Aw9U1IYj6hG/Dyy/3NsFg3YHMkxKeBacgojtOlHOO+z4Deylj1WjjjhrwejGPqfmApXPMHfMjKvhcax6605GxwpghexYspdVDLAGO7f/V1H8sPTcDwQlKEqkzuD/EtJ/24gCH2WVDfy3KqTX5HSP/f4uJaGoeZcI8GL2LOM55vioiWIhhHcWZu+xwJFRcnfuTacuGFmQfXe52oRJKmwNpAdrFOE=
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>

On 05/11/2018 04:42 PM, Simon Kuenzer wrote:
> Whenever a condition expression for UK_ASSERT() and UK_WARNIF()
> is not fulfilled, the macros stringify the condition and print
> it with uk_printd(). Because this string was handed over with
> the format, the modulo operator (%) in the expression causes
> formatting errors.
> This patch hands over this condition string as separate argument
> which will not be processed by uk_printd().
> 
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
>  lib/ukdebug/include/uk/assert.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ukdebug/include/uk/assert.h b/lib/ukdebug/include/uk/assert.h
> index 70e9e72..8569cdc 100644
> --- a/lib/ukdebug/include/uk/assert.h
> +++ b/lib/ukdebug/include/uk/assert.h
> @@ -48,7 +48,8 @@
>  #define UK_ASSERT(x)                                                 \
>       do {                                                            \
>               if (unlikely(!(x))) {                                   \
> -                     uk_printd(DLVL_CRIT, "Assertion failure: " STRINGIFY(x) 
> "\n"); \
> +                     uk_printd(DLVL_CRIT, "Assertion failure: %s\n", \
> +                               STRINGIFY(x));                        \
>                       /* TODO: stack trace */                         \
>                       ukplat_terminate(UKPLAT_CRASH);                 \
>               }                                                       \
> @@ -57,7 +58,8 @@
>  #define UK_WARNIF(x)                                                 \
>       do {                                                            \
>               if (unlikely(x)) {                                      \
> -                     uk_printd(DLVL_WARN, "Condition warning: " STRINGIFY(x) 
> "\n"); \
> +                     uk_printd(DLVL_WARN, "Condition warning: %s\n", \
> +                               STRINGIFY(x));                        \
>               }                                                       \
>       } while (0)
>  
> 

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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