lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202204260549.BK1ztC91-lkp@intel.com>
Date:   Tue, 26 Apr 2022 05:59:17 +0800
From:   kernel test robot <lkp@...el.com>
To:     Janne Grunau <j@...nau.net>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Hector Martin <marcan@...can.st>
Subject: [asahilinux:pr/22 73/189] drivers/hid/hid-magicmouse.c:662:41:
 warning: format specifies type 'unsigned short' but the argument has type
 'int'

tree:   https://github.com/AsahiLinux/linux pr/22
head:   7ee315306d1a3b0da8cf2a53e7f55889d0e7f034
commit: 03f2bf13a1adfe8af74f01c14af0943adef72470 [73/189] HID: magicmouse: add support for Macbook trackpads
config: hexagon-randconfig-r041-20220425 (https://download.01.org/0day-ci/archive/20220426/202204260549.BK1ztC91-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/AsahiLinux/linux/commit/03f2bf13a1adfe8af74f01c14af0943adef72470
        git remote add asahilinux https://github.com/AsahiLinux/linux
        git fetch --no-tags asahilinux pr/22
        git checkout 03f2bf13a1adfe8af74f01c14af0943adef72470
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/hid/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> drivers/hid/hid-magicmouse.c:662:41: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
                   hid_dbg(hdev, "ev x:%04hx y:%04hx\n", le16_to_int(f->abs_x),
                                       ~~~~~             ^~~~~~~~~~~~~~~~~~~~~
                                       %04x
   include/linux/hid.h:1218:30: note: expanded from macro 'hid_dbg'
           dev_dbg(&(hid)->dev, fmt, ##__VA_ARGS__)
                                ~~~    ^~~~~~~~~~~
   include/linux/dev_printk.h:155:39: note: expanded from macro 'dev_dbg'
           dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                        ~~~     ^~~~~~~~~~~
   include/linux/dynamic_debug.h:167:19: note: expanded from macro 'dynamic_dev_dbg'
                              dev, fmt, ##__VA_ARGS__)
                                   ~~~    ^~~~~~~~~~~
   include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic_func_call'
           __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
                                                                 ^~~~~~~~~~~
   include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynamic_func_call'
                   func(&id, ##__VA_ARGS__);               \
                               ^~~~~~~~~~~
   drivers/hid/hid-magicmouse.c:663:4: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
                           le16_to_int(f->abs_y));
                           ^~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1218:30: note: expanded from macro 'hid_dbg'
           dev_dbg(&(hid)->dev, fmt, ##__VA_ARGS__)
                                ~~~    ^~~~~~~~~~~
   include/linux/dev_printk.h:155:39: note: expanded from macro 'dev_dbg'
           dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                        ~~~     ^~~~~~~~~~~
   include/linux/dynamic_debug.h:167:19: note: expanded from macro 'dynamic_dev_dbg'
                              dev, fmt, ##__VA_ARGS__)
                                   ~~~    ^~~~~~~~~~~
   include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic_func_call'
           __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
                                                                 ^~~~~~~~~~~
   include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynamic_func_call'
                   func(&id, ##__VA_ARGS__);               \
                               ^~~~~~~~~~~
   2 warnings generated.
--
   drivers/hid/hid-magicmouse.c:169: warning: Function parameter or member 'pos' not described in 'magicmouse_sc'
   drivers/hid/hid-magicmouse.c:169: warning: Function parameter or member 'hdev' not described in 'magicmouse_sc'
   drivers/hid/hid-magicmouse.c:169: warning: Function parameter or member 'work' not described in 'magicmouse_sc'
   drivers/hid/hid-magicmouse.c:169: warning: Function parameter or member 'battery_timer' not described in 'magicmouse_sc'
   drivers/hid/hid-magicmouse.c:169: warning: Function parameter or member 'input_ops' not described in 'magicmouse_sc'
>> drivers/hid/hid-magicmouse.c:592: warning: expecting prototype for struct trackpad. Prototype was for struct tp_header instead


vim +662 drivers/hid/hid-magicmouse.c

   571	
   572	/**
   573	 * struct trackpad report
   574	 *
   575	 * @report_id:		reportid
   576	 * @buttons:		HID Usage Buttons 3 1-bit reports
   577	 * @num_fingers:	the number of fingers being reported in @fingers
   578	 * @clicked:		same as @buttons
   579	 */
   580	struct tp_header {
   581		// HID mouse report
   582		u8 report_id;
   583		u8 buttons;
   584		u8 rel_x;
   585		u8 rel_y;
   586		u8 padding[4];
   587		// HID vendor part, up to 1751 bytes
   588		u8 unknown[22];
   589		u8 num_fingers;
   590		u8 clicked;
   591		u8 unknown3[14];
 > 592	};
   593	
   594	static inline int le16_to_int(__le16 x)
   595	{
   596		return (signed short)le16_to_cpu(x);
   597	}
   598	
   599	static void report_finger_data(struct input_dev *input, int slot,
   600				       const struct input_mt_pos *pos,
   601				       const struct tp_finger *f)
   602	{
   603		input_mt_slot(input, slot);
   604		input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
   605	
   606		input_report_abs(input, ABS_MT_TOUCH_MAJOR,
   607				 le16_to_int(f->touch_major) << 1);
   608		input_report_abs(input, ABS_MT_TOUCH_MINOR,
   609				 le16_to_int(f->touch_minor) << 1);
   610		input_report_abs(input, ABS_MT_WIDTH_MAJOR,
   611				 le16_to_int(f->tool_major) << 1);
   612		input_report_abs(input, ABS_MT_WIDTH_MINOR,
   613				 le16_to_int(f->tool_minor) << 1);
   614		input_report_abs(input, ABS_MT_ORIENTATION,
   615				 J314_TP_MAX_FINGER_ORIENTATION - le16_to_int(f->orientation));
   616		input_report_abs(input, ABS_MT_PRESSURE, le16_to_int(f->pressure));
   617		input_report_abs(input, ABS_MT_POSITION_X, pos->x);
   618		input_report_abs(input, ABS_MT_POSITION_Y, pos->y);
   619	}
   620	
   621	static int magicmouse_raw_event_spi(struct hid_device *hdev,
   622			struct hid_report *report, u8 *data, int size)
   623	{
   624		struct magicmouse_sc *msc = hid_get_drvdata(hdev);
   625		struct input_dev *input = msc->input;
   626		struct tp_header *tp_hdr;
   627		struct tp_finger *f;
   628		int i, n;
   629		u32 npoints;
   630		const size_t hdr_sz = sizeof(struct tp_header);
   631		const size_t touch_sz = sizeof(struct tp_finger);
   632		u8 map_contacs[MAX_CONTACTS];
   633	
   634		// hid_warn(hdev, "%s\n", __func__);
   635		// print_hex_dump_debug("appleft ev: ", DUMP_PREFIX_OFFSET, 16, 1, data,
   636		// 		     size, false);
   637	
   638		if (data[0] != TRACKPAD2_USB_REPORT_ID)
   639			return 0;
   640	
   641		/* Expect 46 bytes of prefix, and N * 30 bytes of touch data. */
   642		if (size < hdr_sz || ((size - hdr_sz) % touch_sz) != 0)
   643			return 0;
   644	
   645		tp_hdr = (struct tp_header *)data;
   646	
   647		npoints = (size - hdr_sz) / touch_sz;
   648		if (npoints < tp_hdr->num_fingers || npoints > MAX_CONTACTS) {
   649			hid_warn(hdev,
   650				 "unexpected number of touches (%u) for "
   651				 "report\n",
   652				 npoints);
   653			return 0;
   654		}
   655	
   656		n = 0;
   657		for (i = 0; i < tp_hdr->num_fingers; i++) {
   658			f = (struct tp_finger *)(data + hdr_sz + i * touch_sz);
   659			if (le16_to_int(f->touch_major) == 0)
   660				continue;
   661	
 > 662			hid_dbg(hdev, "ev x:%04hx y:%04hx\n", le16_to_int(f->abs_x),
   663				le16_to_int(f->abs_y));
   664			msc->pos[n].x = le16_to_int(f->abs_x);
   665			msc->pos[n].y = -le16_to_int(f->abs_y);
   666			map_contacs[n] = i;
   667			n++;
   668		}
   669	
   670		input_mt_assign_slots(input, msc->tracking_ids, msc->pos, n, 0);
   671	
   672		for (i = 0; i < n; i++) {
   673			int idx = map_contacs[i];
   674			f = (struct tp_finger *)(data + hdr_sz + idx * touch_sz);
   675			report_finger_data(input, msc->tracking_ids[i], &msc->pos[i], f);
   676		}
   677	
   678		input_mt_sync_frame(input);
   679		input_report_key(input, BTN_MOUSE, data[1] & 1);
   680	
   681		input_sync(input);
   682		return 1;
   683	}
   684	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ