The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	mm-commits@vger.kernel.org, masahiroy@kernel.org,
	keescook@chromium.org, gregkh@linuxfoundation.org,
	andriy.shevchenko@linux.intel.com
Subject: Re: [PATCH -mm] -funsigned-char, x86: make struct p4_event_bind::cntr signed array
Date: Fri, 21 Oct 2022 08:59:39 +0300	[thread overview]
Message-ID: <Y1I1S86zbBmeJ+jq@localhost.localdomain> (raw)
In-Reply-To: <CAHk-=whFow9Wd6C8htoRUt5wXbwf1i_qbuArBbhXOPqYsTFvtw@mail.gmail.com>

On Thu, Oct 20, 2022 at 10:14:54AM -0700, Linus Torvalds wrote:
> On Thu, Oct 20, 2022 at 9:28 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > Nice catch.
> >
> > Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
> 
> Can we please try to collect these all in one place?
> 
> I see that Andrew picked up the original one for -mm, but I think it
> would be better if we had one specific place for all of this (one
> branch) to collect it all.
> 
> I'm actually trying to do a "make allyesconfig" build on x86-64 with
> both signed and unsigned char, and trying to see if I can script
> something sane to show differences.

It is very entertaining, i've given up and started patching sparse
but it needs more because char constants are ints:


diff --git a/evaluate.c b/evaluate.c
index 61f59ee3..ab607581 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -321,6 +321,10 @@ static struct expression * cast_to(struct expression *old, struct symbol *type)
 	if (old->ctype != &null_ctype && is_same_type(old, type))
 		return old;
 
+	if (is_char_type(old->ctype)) {
+		sparse_error(old->pos, "XXX char");
+	}
+
 	expr = alloc_expression(old->pos, EXPR_IMPLIED_CAST);
 	expr->ctype = type;
 	expr->cast_type = type;
diff --git a/symbol.h b/symbol.h
index 5270fcd7..8e62aca2 100644
--- a/symbol.h
+++ b/symbol.h
@@ -455,6 +455,14 @@ static inline int is_byte_type(struct symbol *type)
 	return type->bit_size == bits_in_char && type->type != SYM_BITFIELD;
 }
 
+static inline int is_char_type(const struct symbol *type)
+{
+	if (type->type == SYM_NODE) {
+		type = type->ctype.base_type;
+	}
+	return type == &char_ctype;
+}
+
 static inline int is_wchar_type(struct symbol *type)
 {
 	if (type->type == SYM_NODE)

  parent reply	other threads:[~2022-10-21  5:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221020000356.177CDC433C1@smtp.kernel.org>
2022-10-20  9:43 ` + kbuild-treat-char-as-always-unsigned.patch added to mm-nonmm-unstable branch Alexey Dobriyan
2022-10-20  9:49 ` [PATCH -mm] -funsigned-char, x86: make struct p4_event_bind::cntr signed array Alexey Dobriyan
2022-10-20  9:56   ` [PATCH -mm] -funsigned-char, namei: delete cast in lookup_one_common() Alexey Dobriyan
2022-10-20 16:28   ` [PATCH -mm] -funsigned-char, x86: make struct p4_event_bind::cntr signed array Jason A. Donenfeld
2022-10-20 17:14     ` Linus Torvalds
2022-10-20 17:33       ` Jason A. Donenfeld
2022-10-20 17:42         ` Linus Torvalds
2022-10-20 18:57           ` Kees Cook
2022-10-20 19:39             ` Linus Torvalds
2022-10-20 20:17               ` Linus Torvalds
2022-10-20 21:34                 ` Andy Shevchenko
2022-10-20 22:46                   ` Jason A. Donenfeld
2022-10-21  6:48                 ` Greg KH
2022-10-21  7:24                   ` Jason A. Donenfeld
2022-10-21  7:36                     ` Greg KH
2022-10-26  1:50             ` Jason A. Donenfeld
2022-10-26 12:58               ` Jason A. Donenfeld
2022-10-26 13:17                 ` Andy Shevchenko
2022-11-02 17:17                 ` [cocci] " Julia Lawall
2022-11-03  0:08                   ` Jason A. Donenfeld
2022-11-03  6:31                     ` Julia Lawall
2022-11-03 12:45                     ` Julia Lawall
2022-11-03 12:47                       ` Jason A. Donenfeld
2022-11-03 12:57                         ` Julia Lawall
2022-11-03 14:07                           ` Jason A. Donenfeld
2022-10-24 15:44         ` Jason A. Donenfeld
2022-10-21  5:59       ` Alexey Dobriyan [this message]
2022-10-21 17:11         ` Linus Torvalds
2022-10-21 17:23           ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1I1S86zbBmeJ+jq@localhost.localdomain \
    --to=adobriyan@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox