From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by gnuweeb.org (Postfix) with ESMTPSA id 8237C7E4A6 for ; Fri, 20 May 2022 11:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1653046209; bh=YfGkukxiI9NdB5uZmq9l5JnIO/B6pKFHg541ag61jVk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UduQS/xeeDdo8uGSVr+7YIZRxCuC4Ll50KiINTOQKs6U3ZNRMgAiH6w/RY1pgJOub 5DcoGxRavDViH0CJYK6s4xfrFtGHMn2BmHQJbHb7kGIPpht9nm+tUKm7yS0t3eE8Zj CwtQieK8snVU3ITCjQW5OyREuYAZtAqWCsxXU46HMsMBBPmoHHjg7H8oFuBkYDucNa /ED5gXrJUWHQv610aIuf698eVymk6RJ4Ox+N9owRqd/ozYpqFTMOPZoBirw6fd/52a cJY2o5cW1ZvtzvzysNanvevsMPO0aiFAxtgt4lpUPhKfjr/fS/046I7znY9daCjLMl kUxnwAsBxO7UQ== Received: by mail-lf1-f47.google.com with SMTP id bu29so13878816lfb.0 for ; Fri, 20 May 2022 04:30:09 -0700 (PDT) X-Gm-Message-State: AOAM530f/VfXD0FsE9NMuH0mKQJLHxorn5iMXfi9m/G2HgrrR+1dcbMH 4FTEfwu8vw2HnReRBSxYv7o2xaLIGhHZMhvNPC4= X-Google-Smtp-Source: ABdhPJzT12I7iYIUbIEXo3WYPp4EJegEjIEuHSRkMgcluCxYOtwOwEjQz//oUBSb66eDFiGgSXW3dRiWRfiG8dOZvjc= X-Received: by 2002:a05:6512:3d8e:b0:478:545d:da06 with SMTP id k14-20020a0565123d8e00b00478545dda06mr1693995lfv.610.1653046207588; Fri, 20 May 2022 04:30:07 -0700 (PDT) MIME-Version: 1.0 References: <20220519172116.283687-1-ammarfaizi2@gnuweeb.org> <20220519172116.283687-2-ammarfaizi2@gnuweeb.org> In-Reply-To: <20220519172116.283687-2-ammarfaizi2@gnuweeb.org> From: Alviro Iskandar Setiawan Date: Fri, 20 May 2022 18:29:56 +0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/2] tools/nolibc/stdlib: Support overflow checking for older compiler versions To: Ammar Faizi Cc: "Paul E. McKenney" , Willy Tarreau , Linux Kernel Mailing List , "GNU/Weeb Mailing List" , Facebook Kernel Team Content-Type: text/plain; charset="UTF-8" List-Id: On Fri, May 20, 2022 at 12:21 AM Ammar Faizi wrote: > Previously, we used __builtin_mul_overflow() to check for overflow in > the multiplication operation in the calloc() function. However, older > compiler versions don't support this built-in. This patch changes the > overflow checking mechanism to make it work on any compiler version > by using a division method to check for overflow. No functional change > intended. While in there, remove the unused variable `void *orig`. > > Link: https://lore.kernel.org/lkml/20220330024114.GA18892@1wt.eu > Suggested-by: Willy Tarreau > Cc: Alviro Iskandar Setiawan > Signed-off-by: Ammar Faizi Reviewed-by: Alviro Iskandar Setiawan tq -- Viro