oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [char-misc:char-misc-next 63/70] drivers/accessibility/speakup/devsynth.c:111:3: warning: label at end of compound statement is a C2x extension
Date: Sat, 9 Mar 2024 01:31:49 +0800	[thread overview]
Message-ID: <202403090122.cpUNsozM-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next
head:   367b3560e10bbae3660d8ba4d0a7cc92170d8398
commit: 807977260ae4de1cf39cfc55713fc0bc56566f7a [63/70] speakup: Add /dev/synthu device
config: i386-buildonly-randconfig-001-20240308 (https://download.01.org/0day-ci/archive/20240309/202403090122.cpUNsozM-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240309/202403090122.cpUNsozM-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403090122.cpUNsozM-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/accessibility/speakup/devsynth.c:111:3: warning: label at end of compound statement is a C2x extension [-Wc2x-extensions]
     111 |                 }
         |                 ^
   1 warning generated.


vim +111 drivers/accessibility/speakup/devsynth.c

    37	
    38	/* UTF-8 version */
    39	static ssize_t speakup_file_writeu(struct file *fp, const char __user *buffer,
    40					   size_t nbytes, loff_t *ppos)
    41	{
    42		size_t count = nbytes, want;
    43		const char __user *ptr = buffer;
    44		size_t bytes;
    45		unsigned long flags;
    46		unsigned char buf[256];
    47		u16 ubuf[256];
    48		size_t in, in2, out;
    49	
    50		if (!synth)
    51			return -ENODEV;
    52	
    53		want = 1;
    54		while (count >= want) {
    55			/* Copy some UTF-8 piece from userland */
    56			bytes = min(count, sizeof(buf));
    57			if (copy_from_user(buf, ptr, bytes))
    58				return -EFAULT;
    59	
    60			/* Convert to u16 */
    61			for (in = 0, out = 0; in < bytes; in++) {
    62				unsigned char c = buf[in];
    63				int nbytes = 8 - fls(c ^ 0xff);
    64				u32 value;
    65	
    66				switch (nbytes) {
    67				case 8: /* 0xff */
    68				case 7: /* 0xfe */
    69				case 1: /* 0x80 */
    70					/* Invalid, drop */
    71					goto drop;
    72	
    73				case 0:
    74					/* ASCII, copy */
    75					ubuf[out++] = c;
    76					continue;
    77	
    78				default:
    79					/* 2..6-byte UTF-8 */
    80	
    81					if (bytes - in < nbytes) {
    82						/* We don't have it all yet, stop here
    83						 * and wait for the rest
    84						 */
    85						bytes = in;
    86						want = nbytes;
    87						continue;
    88					}
    89	
    90					/* First byte */
    91					value = c & ((1u << (7 - nbytes)) - 1);
    92	
    93					/* Other bytes */
    94					for (in2 = 2; in2 <= nbytes; in2++) {
    95						c = buf[in + 1];
    96						if ((c & 0xc0) != 0x80)	{
    97							/* Invalid, drop the head */
    98							want = 1;
    99							goto drop;
   100						}
   101						value = (value << 6) | (c & 0x3f);
   102						in++;
   103					}
   104	
   105					if (value < 0x10000)
   106						ubuf[out++] = value;
   107					want = 1;
   108					break;
   109				}
   110	drop:
 > 111			}
   112	
   113			count -= bytes;
   114			ptr += bytes;
   115	
   116			/* And speak this up */
   117			if (out) {
   118				spin_lock_irqsave(&speakup_info.spinlock, flags);
   119				for (in = 0; in < out; in++)
   120					synth_buffer_add(ubuf[in]);
   121				synth_start();
   122				spin_unlock_irqrestore(&speakup_info.spinlock, flags);
   123			}
   124		}
   125	
   126		return (ssize_t)(nbytes - count);
   127	}
   128	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-03-08 17:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202403090122.cpUNsozM-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=samuel.thibault@ens-lyon.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;
as well as URLs for NNTP newsgroup(s).