Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1406991ybv; Thu, 13 Feb 2020 22:46:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwb64JbM4xQSNwojDfsVhw0lD1UgIYYzwbuyQxQVxBLAgrdzccEnSpZfdt4nGjlh4GA2Boj X-Received: by 2002:a9d:65cb:: with SMTP id z11mr1032038oth.348.1581662806866; Thu, 13 Feb 2020 22:46:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581662806; cv=none; d=google.com; s=arc-20160816; b=ZOKYpUfWY4eurjyL8xiRlDHILuuvrCCmOFv63R2AQcyaJyjadvHVzW7UGq5cfY0T6N yBotdYJVWbpnvY/jUnP+zO99biIwzSZoboQ/hgbhdbntJEOWAWehUbRw0DhExFX9X+cX io8s5pxJawpL6zGZDXVkL0EHJq9Zb13/h3gJV9Rf6Ku8FrA6QpRbqow8YeVrLxokVzzG H555T725/xbh1A5Jqi8BMCXgndKUl3bvN0kM2FHGWgJmuYkYie0CQ3MsgzFS3tIXLRLg m65OMoKYNXGmPHyIp4BJwDKgx3EawipX/JY60uXaGk2tvmWhI3DpwCXP4vMWGGoDrrV0 wg1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RKB2u4zCoEkjwdZrkIjqRIz/kGGuU98/UeeGnME5DaU=; b=RBM9Fln9vWZ6yKVQwc6vsViM4YIr8+MU1pGcftF3KHnGDNQZCP4DNdgjD9CFZzDGbV 6rQwNKwE0UiwY/WTd1XAEShZoqoaNe4RuwupPLmZTanPDvqM4U08C7jH3r40kj3hgpBx xyNv4KlQinnTfWzpJYACxfU8lKiPzE14Ofl8fKjck0IzXUPCYXoEuH0Dceul8/kc0xmA cN5dK0icGWip3uidrp0NGVFDCb57TO1+SkHlaX/W+mIwT6Nn7a9FjXC+GPBf+4yjKyf9 dYmncsL8XfAHaf9Zb/7xqn2Zd0PNJ8QutRZ9HQVa6fiBbpE6efY97CjUbH4HRF9xdsad 9EYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ttCnz5S7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si2565863oti.47.2020.02.13.22.46.34; Thu, 13 Feb 2020 22:46:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ttCnz5S7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728239AbgBNGqb (ORCPT + 99 others); Fri, 14 Feb 2020 01:46:31 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:44805 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbgBNGqb (ORCPT ); Fri, 14 Feb 2020 01:46:31 -0500 Received: by mail-ot1-f68.google.com with SMTP id h9so8140396otj.11; Thu, 13 Feb 2020 22:46:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RKB2u4zCoEkjwdZrkIjqRIz/kGGuU98/UeeGnME5DaU=; b=ttCnz5S7kxwNor+Pg9JqXzpmTLKABDEHvB7sGge2iEYkklLODvA9iLE16n0zCr0md5 LeKRss6HpKBr36JLi8jhVz9ViNQIYqZyGE4wpLx82HCrThF5XBPY01BUY0TySsuWtiX7 rBwqw+4xI6lw1sUiH+5YlYeRK3aOPhms+VSGSgl6748lUDIgwRJ0DGHWYTWgExt6EUlP 1zjlhXi6eqJSdUliR4iBiefnczuQX3DEUtEffTFeWf0dFW084tA2boUDhTYlpKqrnSA8 4H/JWoQZhQvVtd7tO98D0weOOZ1Z4313MtBmtKd1xIbo02a3icnu8ZC3zA+0zRY+h8Gq BUFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RKB2u4zCoEkjwdZrkIjqRIz/kGGuU98/UeeGnME5DaU=; b=EoeNREgU4mEe5aeQAifVsfUHjplk2we95vMwhfbzItN+hiJntNJJwdb5QjOjVqBvHm ODb74B/Zv49jRuMP9KvBbJO9jZ/HXPaNKZAjE01A3QsybPC8ZZd795gZ5jxkQy8hJrJs /fyNVE+WJ9teloYP2kwWAjp6g5nHCgBFzmyEbNizdpxPwMPrbOVVWHW52JKJZj80cLqd EgbixJK8GX/BBAVSkhJ6ICnUchaKhZiEBpeWlLR9mzOb3IGePVECw9EX8YW0zx8axJRn yb+5+ilPFi88cnKLuw0bX66Zt5gFiULyGbxLKcb4i9clV/SqYJXwZPzYDHu0JHIHm/LG Ec1g== X-Gm-Message-State: APjAAAWYQCsHJS1uxFUiND4lStilHSN65svfre0lFMTdMLw28KujHhAg xCnQBbmW3JolbdeUP4w2By0= X-Received: by 2002:a9d:6f85:: with SMTP id h5mr1082932otq.19.1581662790329; Thu, 13 Feb 2020 22:46:30 -0800 (PST) Received: from ubuntu-m2-xlarge-x86 ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id r2sm1676849otk.22.2020.02.13.22.46.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Feb 2020 22:46:29 -0800 (PST) Date: Thu, 13 Feb 2020 23:46:28 -0700 From: Nathan Chancellor To: Joe Perches Cc: Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] s390/kaslr: Fix casts in get_random Message-ID: <20200214064628.GA14336@ubuntu-m2-xlarge-x86> References: <20200208141052.48476-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 08, 2020 at 12:17:20PM -0800, Joe Perches wrote: > On Sat, 2020-02-08 at 07:10 -0700, Nathan Chancellor wrote: > > Clang warns: > > > > ../arch/s390/boot/kaslr.c:78:25: warning: passing 'char *' to parameter > > of type 'const u8 *' (aka 'const unsigned char *') converts between > > pointers to integer > > types with different sign [-Wpointer-sign] > > (char *) entropy, (char *) entropy, > > ^~~~~~~~~~~~~~~~ > > ../arch/s390/include/asm/cpacf.h:280:28: note: passing argument to > > parameter 'src' here > > u8 *dest, const u8 *src, long src_len) > > ^ > > 2 warnings generated. > > > > Fix the cast to match what else is done in this function. > > > > Fixes: b2d24b97b2a9 ("s390/kernel: add support for kernel address space layout randomization (KASLR)") > > Link: https://github.com/ClangBuiltLinux/linux/issues/862 > > Signed-off-by: Nathan Chancellor > > --- > > arch/s390/boot/kaslr.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/s390/boot/kaslr.c b/arch/s390/boot/kaslr.c > > index 5d12352545c5..5591243d673e 100644 > > --- a/arch/s390/boot/kaslr.c > > +++ b/arch/s390/boot/kaslr.c > > @@ -75,7 +75,7 @@ static unsigned long get_random(unsigned long limit) > > *(unsigned long *) prng.parm_block ^= seed; > > for (i = 0; i < 16; i++) { > > cpacf_kmc(CPACF_KMC_PRNG, prng.parm_block, > > - (char *) entropy, (char *) entropy, > > + (u8 *) entropy, (u8 *) entropy, > > Why not change the function to take void *? > > static inline int cpacf_kmc(unsigned long func, void *param, > u8 *dest, const u8 *src, long src_len) > > vs: > > static inline int cpacf_kmc(unsigned long func, void *param, > void *dest, const void *src, long src_len) > > and remove the casts? I can certainly do that if the maintainers prefer it. Cheers, Nathan