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: <CANq1E4TawZ7d=dvKjCi_r3ai9yo3kyMMYJAPh_0wV4T68Xpqng@mail.gmail.com>
Date:	Tue, 14 Aug 2012 13:07:06 +0200
From:	David Herrmann <dh.herrmann@...glemail.com>
To:	Ryan Mallon <rmallon@...il.com>
Cc:	linux-fbdev@...r.kernel.org,
	Florian Tobias Schandinat <FlorianSchandinat@....de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-serial@...r.kernel.org, Alan Cox <alan@...rguk.ukuu.org.uk>,
	linux-kernel@...r.kernel.org,
	Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: Re: [PATCH 07/11] fblog: allow selecting fbs via sysfs and module-parameters

Hi Ryan

On Mon, Aug 13, 2012 at 2:04 AM, Ryan Mallon <rmallon@...il.com> wrote:
> On 13/08/12 00:53, David Herrmann wrote:
>> +static ssize_t fblog_dev_active_show(struct device *dev,
>> +                                  struct device_attribute *attr,
>> +                                  char *buf)
>> +{
>> +     struct fblog_fb *fb = to_fblog_dev(dev);
>> +
>> +     return snprintf(buf, PAGE_SIZE, "%d\n",
>> +                     !!test_bit(FBLOG_OPEN, &fb->flags));
>
> Nitpick. sprintf is okay here, %d is rarely longer than PAGE_SIZE :-).
>
>> +}
>> +
>> +static ssize_t fblog_dev_active_store(struct device *dev,
>> +                                   struct device_attribute *attr,
>> +                                   const char *buf,
>> +                                   size_t count)
>> +{
>> +     struct fblog_fb *fb = to_fblog_dev(dev);
>> +     unsigned long num;
>> +     int ret = 0;
>> +
>> +     num = simple_strtoul(buf, NULL, 10);
>
> kstrtoul is preferred these days I think, it also catches errors.
>
>> +
>> +     mutex_lock(&fb->info->lock);
>> +     if (num)
>> +             ret = fblog_open(fb);
>> +     else
>> +             fblog_close(fb, false);
>> +     mutex_unlock(&fb->info->lock);
>> +
>> +     return ret ? ret : count;
>
> Nitpick, you can use gcc's shortcut form of the ? operator here:
>
>         return ret ?: count;
>
>> @@ -186,7 +228,20 @@ static void fblog_do_register(struct fb_info *info, bool force)
>>               return;
>>       }
>>
>> -     fblog_open(fb);
>> +     ret = device_create_file(&fb->dev, &dev_attr_active);
>> +     if (ret) {
>> +             pr_err("fblog: cannot create sysfs entry");
>
> Shouldn't need the "fblog: " prefix, since you have pr_fmt defined.
>
>> +             /* do not open fb if we cannot create control file */
>> +             do_open = false;
>> +     }
>> +
>> +     if (!activate_on_hotplug)
>> +             do_open = false;
>> +     if (main_only && info->node != 0)
>> +             do_open = false;
>> +
>> +     if (do_open)
>> +             fblog_open(fb);
>>  }
>>
>>  static void fblog_register(struct fb_info *info, bool force)

All four fixes make sense, thanks!
David
--
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