From nobody Sat Feb 25 00:08:36 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PNnDL1VMGz3v6P1; Sat, 25 Feb 2023 00:08:50 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNnDK2P67z4M2W; Sat, 25 Feb 2023 00:08:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.167.43 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com; dmarc=none Received: by mail-lf1-f43.google.com with SMTP id m7so1258512lfj.8; Fri, 24 Feb 2023 16:08:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K9ho/T0bxd8Ft9wkvOwS3iQpwdVXSVQwmvgPbZu8Dto=; b=r9gBMy8RQqHFeKUE/53AYrulks4z3HuQ73eflJwb5mX8rF9SkqLrK7D6HNGoDRe1w0 aaT1GyJEpb6eedh9hX3REBQdepFbVQkZRstfSGkdsSavFxJnhKIPUt41LwT6rXSNkXsO rvlFXxQWENJK9djCjDwf/IiocVq++s43UcFreq0wWw6YEiu8QeJcsINrgm2lJVTZKHWz updpx0Strz9Xa0I3bhV3ITrwSzhtopKh4zoE462tXfvXgKtorOWbf/TyfDxQtco04Csp QzqhK9SHomTkBFApJ49p07YIpTPJb/lfrXVqpsReMOX4pr9RL2keHm3spYM/ywyTtNMP s/DQ== X-Gm-Message-State: AO0yUKWSbrtaqEZHX55NlLFHqrLOQlukdeclbRWzmQucWZa9LY6ou40V FVT9UnpfSJVKHPByBDJ9ukujhgOKt6rYO2hf8SkHXpW0 X-Google-Smtp-Source: AK7set91gAeuMU+C2qyEjY1SdBtthZaCbGjsF2AZK938t1UZWvaATegRiGPesYVTc5hxmICkEQbIWTAEsEM9uQdgE0E= X-Received: by 2002:a19:7416:0:b0:4d5:ca32:9bd6 with SMTP id v22-20020a197416000000b004d5ca329bd6mr5396653lfe.2.1677283726574; Fri, 24 Feb 2023 16:08:46 -0800 (PST) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202302241821.31OIL4ux075893@gitrepo.freebsd.org> <20230224205001.Fbn1A%steffen@sdaoden.eu> In-Reply-To: <20230224205001.Fbn1A%steffen@sdaoden.eu> From: Ed Maste Date: Fri, 24 Feb 2023 19:08:36 -0500 Message-ID: Subject: Re: git: 2c709ee70ade - main - libc: handle zero alignment in memalign() To: Ed Maste , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Spamd-Result: default: False [-2.97 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.971]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.43:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[carpeddiem]; FREEMAIL_ENVFROM(0.00)[gmail.com]; R_DKIM_NA(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.43:from]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4PNnDK2P67z4M2W X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N On Fri, 24 Feb 2023 at 18:26, Steffen Nurpmeso wrote: > > Ed Maste wrote in > <202302241821.31OIL4ux075893@gitrepo.freebsd.org>: > |URL: https://cgit.FreeBSD.org/src/commit/?id=2c709ee70ade9fd8f77b37917a4\ > |169d667dda41d > ... > |commit 2c709ee70ade9fd8f77b37917a4169d667dda41d > |Author: Paul Floyd > |AuthorDate: 2023-02-24 16:29:01 +0000 > |Commit: Ed Maste > |CommitDate: 2023-02-24 18:19:06 +0000 > | > | libc: handle zero alignment in memalign() > | > | For compatibility with glibc. The previous code would trigger a \ > | division > | by zero in roundup() and terminate. Instead, just pass through to > | malloc() for align == 0. > ... > |- return (aligned_alloc(align, roundup(size, align))); > |+ /* > |+ * glibc allows align == 0, but that is not valid for roundup. > |+ * Just pass through to malloc in that case. > |+ */ > |+ if (align != 0) > |+ return (aligned_alloc(align, roundup(size, align))); > |+ else > |+ return (malloc(size)); > > Just out of interest. Why not 1? > Or "if(align==0)align=1;"? Yes that's what I would have done, but it's fine either way and I just took the submission. > (Which is what i always did, as> "allocating nothing" is merely a debug concern, which, for better > memory pools like OpenBSD (i would presume), or during ASAN, > causes better (even upon read).) I don't really understand what you mean here, or how "allocating nothing" is related.