From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by sourceware.org (Postfix) with ESMTPS id 79D313858C55 for ; Thu, 29 Sep 2022 19:40:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79D313858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-x72f.google.com with SMTP id o7so1518971qkj.10 for ; Thu, 29 Sep 2022 12:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=huhzN5bdl7V10GotontfivK8rWqEcJRBqftf24I1fOg=; b=CeWfC6TN2IGsa8fxzUCmnlFBvN+wbffjeH0ECsmSA6KUquOqEBuZD3jH057YtIuP8I wunFY86I67idHpQBxOXrNyeTmeTvcKrwCG+Zqm88+q9D7aYPkCJZ533M/wT2yrhn/Oor gk6yZcFA+p65wFXEPChlyiPVk/mWILOvhdkyNjWbJ+JFRlGUyXA3SQAgYTIi0JgRhmK/ 9xSoLvPvOck/7T6ykpn6d9HSx8+rdV9MbeVT4ULoPaFWN+GOyNDxDDx+byvbjDzkCBPW mqjpGXMgrmImBofrZ8763vQZ1ptOMVYLD3w3qMT+ACKz87v5WoY2attzjJ9np2ht5Tcq b6Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=huhzN5bdl7V10GotontfivK8rWqEcJRBqftf24I1fOg=; b=62mEvT9np+1Ue19onYs0u6J3rklgS5SrR5/Id8Ryq+mK8JZqOV4smu8zhM0+F9qBqh WpYu7tQXic4rRSTqcn3X5O1ahNlb7dEpHGBszMUw2heltsCM7LgwMM5RvfskAuN7Fp1f y1vol6cUD4Lqa6hq09xi9SZb1OGzKg7tYCRtC3nhjn55YFzQIx1WUot5Bq9/YE9T35he TYT6iqZWOjSGcFTEp/oRq8NbzjdM65pFN7G3E6zZPVMjK/pntEvrRH4BsFI8mPW0i1hf PV6WqAYzQU6Mw5ZFT253IrPRa5s5YooqLx9cfLVqKGjmYrJUiGQjiP2F2FYBOZme4L/z AFzA== X-Gm-Message-State: ACrzQf13PseT59PQvBehQd4mSZHeolOgel7WHQi7qi5uAk/HTJkp2tgc EJ2ZFO7QizgVtSeCLf0cn1SgxhY8/7jfKTnxW+0= X-Google-Smtp-Source: AMsMyM77sVCRqXytgjxn0vTd4qTQIyO7MTIkPdKz6Z+dBnC4vtPqtwtYxMD9GX80ZuKNK+CuLVYz4bVbMEym25Pz+60= X-Received: by 2002:a05:620a:2683:b0:6cf:3768:8e4b with SMTP id c3-20020a05620a268300b006cf37688e4bmr3451082qkp.768.1664480403815; Thu, 29 Sep 2022 12:40:03 -0700 (PDT) MIME-Version: 1.0 References: <20220929192756.3310704-1-adhemerval.zanella@linaro.org> In-Reply-To: <20220929192756.3310704-1-adhemerval.zanella@linaro.org> From: "H.J. Lu" Date: Thu, 29 Sep 2022 12:39:27 -0700 Message-ID: Subject: Re: [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, Wilco Dijkstra , Yu Chien Peter Lin Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3024.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,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 Thu, Sep 29, 2022 at 12:28 PM Adhemerval Zanella via Libc-alpha wrote: > > Using an unsigned type prevents the fallback to be used if kernel > does not support getrandom syscall. > > Checked on x86_64-linux-gnu. > --- > stdlib/arc4random.c | 2 +- > sysdeps/unix/sysv/linux/not-cancel.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c > index e417ef624d..960a38f295 100644 > --- a/stdlib/arc4random.c > +++ b/stdlib/arc4random.c > @@ -34,7 +34,7 @@ void > __arc4random_buf (void *p, size_t n) > { > static int seen_initialized; > - size_t l; > + ssize_t l; > int fd; > > if (n == 0) > diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h > index a263d294b1..cf35c8bfc9 100644 > --- a/sysdeps/unix/sysv/linux/not-cancel.h > +++ b/sysdeps/unix/sysv/linux/not-cancel.h > @@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) > INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt); > } > > -static inline int > +static inline ssize_t Shouldn't it be __syscall_slong_t? > __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags) > { > return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags); > -- > 2.34.1 > -- H.J.