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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201004011858.45859.oliver@neukum.org>
Date:	Thu, 1 Apr 2010 18:58:45 +0200
From:	Oliver Neukum <oliver@...kum.org>
To:	Bruno Prémont <bonbons@...ux-vserver.org>
Cc:	Jiri Kosina <jkosina@...e.cz>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	linux-input@...r.kernel.org, linux-usb@...r.kernel.org,
	linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	"Rick L. Vinyard Jr." <rvinyard@...nmsu.edu>,
	Nicu Pavel <npavel@...ner.com>,
	Jaya Kumar <jayakumar.lkml@...il.com>
Subject: Re: [PATCH v6 1/8] hid: new driver for PicoLCD device

Am Dienstag, 30. März 2010 22:33:50 schrieb Bruno Prémont:
> +static ssize_t picolcd_operation_mode_store(struct device *dev,
> +               struct device_attribute *attr, const char *buf, size_t count)
> +{
> +       struct picolcd_data *data = dev_get_drvdata(dev);
> +       struct hid_report *report = NULL;
> +       size_t cnt = count;
> +       int timeout = 5000;
> +       unsigned u;
> +       unsigned long flags;
> +
> +       if (cnt >= 3 && strncmp("lcd", buf, 3) == 0) {
> +               if (data->status & PICOLCD_BOOTLOADER)
> +                       report = picolcd_out_report(REPORT_EXIT_FLASHER, data->hdev);
> +               buf += 3;
> +               cnt -= 3;
> +       } else if (cnt >= 10 && strncmp("bootloader", buf, 10) == 0) {
> +               if (!(data->status & PICOLCD_BOOTLOADER))
> +                       report = picolcd_out_report(REPORT_EXIT_KEYBOARD, data->hdev);
> +               buf += 10;
> +               cnt -= 10;
> +       }
> +       if (!report)
> +               return -EINVAL;
> +
> +       while (cnt > 0 && (*buf == ' ' || *buf == '\t')) {
> +               buf++;
> +               cnt--;
> +       }
> +       while (cnt > 0 && (buf[cnt-1] == '\n' || buf[cnt-1] == '\r'))
> +               cnt--;
> +       if (cnt > 0) {
> +               if (sscanf(buf, "%u", &u) != 1)
> +                       return -EINVAL;
> +               if (u > 30000)
> +                       return -EINVAL;
> +               else
> +                       timeout = u;
> +       }
> +
> +       spin_lock_irqsave(&data->lock, flags);
> +       hid_set_field(report->field[0], 0, timeout & 0xff);
> +       hid_set_field(report->field[0], 1, (timeout >> 8) & 0xff);
> +       usbhid_submit_report(data->hdev, report, USB_DIR_OUT);
> +       spin_unlock_irqrestore(&data->lock, flags);
> +       return count;
> +}
> +
> +static DEVICE_ATTR(operation_mode, 0644, picolcd_operation_mode_show,
> +               picolcd_operation_mode_store);

This violates the one file == one attribute rule.
Can you change this interface?

	Regards
		Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ