From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by sourceware.org (Postfix) with ESMTPS id 1D8E93895FFD for ; Thu, 6 Oct 2022 17:36:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1D8E93895FFD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-xc34.google.com with SMTP id s1-20020a4a81c1000000b0047d5e28cdc0so1865460oog.12 for ; Thu, 06 Oct 2022 10:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=dhUOEglDudL5slsZtm+NhXeXmpUM4GDNHhjZHtsTdYs=; b=oBsfwv0gTAqkcN3DV8dUodphP144vxRFELHDutILLpER5DHh6iRT/LD17xsLAX8Skn 2MjtrFoNG9jYl8PgB1b/+V2BalPjseRJek3oz5xic2tV+jpKPfBfWl/948EVAJCxIMSJ cn7g27AomQ6BQBZdm3I0H2QzFOqiKMbUIWUUq25GuxCWWwKrYdgizS6OA9+w/jKn/Sir 0gNXxOqYVgXE0d5yaXFxKcv4r0USTgWRI84R3x4JqKEtW8K9PqPOEEZ1rdMGkIIXrmru 11+30Nmvj9/OZYJ41lh1cMFPJv4D6MuPtK8R9UgAW1PUAtjpnk8nKEBu1bUxCwXd9TkT flhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dhUOEglDudL5slsZtm+NhXeXmpUM4GDNHhjZHtsTdYs=; b=24L7W96n2Mf7Y9htFrASDzkZzVWtF38VyOk+n662wipNQL/RpBmCbh1Gf6Mvp31Hnw 1xisaTSk5BRu1IW39rmenXdepXJK1s/pcCIWd8FQqkXitIsK2SQYTM9FkwYC6ASZ/D6a Rz7jxOFYE+/xD2KyQgYqs+zwRUVhmPEpimxEtU/RecOp4XeDDUQDGwU8wx6J2UnWJ30o CmdCsEx8B3ZkLsZKl8Vnsjh0pT9Joyvm7oawl7jnojXNuGQwbrYCu4pmfZQoa1XgsxAe WLMOMUy0pIhk1pZmEjTF6NWecM1IvolZgq+p97yer1YKg5tzEnPylwpvR2C4IKkBbF6r oIVQ== X-Gm-Message-State: ACrzQf1lfZNTTv6rIXp/NVScc5SdSgpUV201hq5asWRIbFbewv/Aie6i joJlApdiRFaNGlCig26kSdBn+g== X-Google-Smtp-Source: AMsMyM4zjgQUyy0u+pC8SsctrYrZViCbKYE5EjaLaJw2EPzxJAC5H/zkQ02ueFi7NAi5GtH6BfNyTw== X-Received: by 2002:a9d:7f14:0:b0:659:2de8:2148 with SMTP id j20-20020a9d7f14000000b006592de82148mr415759otq.321.1665077810081; Thu, 06 Oct 2022 10:36:50 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c2:b87d:70b2:7867:2da9:30d3? ([2804:1b3:a7c2:b87d:70b2:7867:2da9:30d3]) by smtp.gmail.com with ESMTPSA id l132-20020acabb8a000000b003504e119b10sm5997567oif.44.2022.10.06.10.36.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Oct 2022 10:36:49 -0700 (PDT) Message-ID: <448cd2ac-9db8-4932-2e6c-e781a7184dc0@linaro.org> Date: Thu, 6 Oct 2022 14:36:47 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] socket: Use offsetof in SUN_LEN (bug 29578) Content-Language: en-US To: Andreas Schwab , libc-alpha@sourceware.org References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 19/09/22 10:39, Andreas Schwab via Libc-alpha wrote: > Use offsetof instead of its traditional expansion in the definition of the > SUN_LEN macro, to avoid a warning from the undefined behaviour sanitizer. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > socket/sys/un.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/socket/sys/un.h b/socket/sys/un.h > index 454eafebc9..2b11300e28 100644 > --- a/socket/sys/un.h > +++ b/socket/sys/un.h > @@ -34,10 +34,11 @@ struct sockaddr_un > > > #ifdef __USE_MISC > +# include > # include /* For prototype of `strlen'. */ > > /* Evaluate to actual length of the `sockaddr_un' structure. */ > -# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ > +# define SUN_LEN(ptr) (offsetof (struct sockaddr_un, sun_path) \ > + strlen ((ptr)->sun_path)) > #endif >