Re: [PATCH net-next v2] netlink: provide an ability to set default extack message

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

 



On 29/01/2023 18:51, Leon Romanovsky wrote:
> In netdev common pattern, extack pointer is forwarded to the drivers
> to be filled with error message. However, the caller can easily
> overwrite the filled message.
> 
> Instead of adding multiple "if (!extack->_msg)" checks before any
> NL_SET_ERR_MSG() call, which appears after call to the driver, let's
> add new macro to common code.
> 
> [1] https://lore.kernel.org/all/Y9Irgrgf3uxOjwUm@unreal
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
> ---
> Changelog:
> v2:
>  * Removed () brackets around msg to fix compilation error.
> v1: https://lore.kernel.org/all/d4843760219f20367c27472f084bd8aa729cf321.1674995155.git.leon@xxxxxxxxxx
>  * Added special *_WEAK() macro instead of embedding same check in
>    NL_SET_ERR_MSG_MOD/NL_SET_ERR_MSG_FMT.
>  * Reuse same macro for XFRM code which triggered this patch.
> v0: https://lore.kernel.org/all/2919eb55e2e9b92265a3ba600afc8137a901ae5f.1674760340.git.leon@xxxxxxxxxx
> ---
>  include/linux/netlink.h   | 10 ++++++++++
>  net/bridge/br_switchdev.c | 10 ++++------
>  net/dsa/master.c          |  4 +---
>  net/dsa/slave.c           |  4 +---
>  net/xfrm/xfrm_device.c    |  5 ++++-
>  5 files changed, 20 insertions(+), 13 deletions(-)
> 

Reviewed-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>





[Index of Archives]     [Netdev]     [AoE Tools]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux