From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: Re: [PATCH] fbdev: fbmem: implement error handling in fbmem_init()
Date: Tue, 10 May 2016 09:04:13 +0000 [thread overview]
Message-ID: <5731A40D.4050801@ti.com> (raw)
In-Reply-To: <1462242147-19876-1-git-send-email-khoroshilov@ispras.ru>
[-- Attachment #1.1: Type: text/plain, Size: 1652 bytes --]
Hi,
On 03/05/16 05:22, Alexey Khoroshilov wrote:
> fbmem_init() ignores all errors, while fbmem_exit() does not
> check if deallocating resources are valid.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
> drivers/video/fbdev/core/fbmem.c | 20 +++++++++++++++++---
> 1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 4e73b6f6b1c0..76c1ad96fb37 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1854,17 +1854,31 @@ EXPORT_SYMBOL(fb_set_suspend);
> static int __init
> fbmem_init(void)
> {
> - proc_create("fb", 0, NULL, &fb_proc_fops);
> + int ret;
> +
> + if (!proc_create("fb", 0, NULL, &fb_proc_fops))
> + return -ENOMEM;
>
> - if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
> + ret = register_chrdev(FB_MAJOR, "fb", &fb_fops);
> + if (ret) {
> printk("unable to get major %d for fb devs\n", FB_MAJOR);
> + goto err_chrdev;
> + }
>
> fb_class = class_create(THIS_MODULE, "graphics");
> if (IS_ERR(fb_class)) {
> - printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class));
> + ret = PTR_ERR(fb_class);
> + pr_warn("Unable to create fb class; errno = %d\n", ret);
> fb_class = NULL;
> + goto err_class;
> }
> return 0;
> +
> +err_class:
> + unregister_chrdev(FB_MAJOR, "fb");
> +err_chrdev:
> + remove_proc_entry("fb", NULL);
> + return ret;
> }
>
> #ifdef MODULE
Looks good to me, queueing for 4.7.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2016-05-10 9:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-03 2:22 [PATCH] fbdev: fbmem: implement error handling in fbmem_init() Alexey Khoroshilov
2016-05-10 9:04 ` Tomi Valkeinen [this message]
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=5731A40D.4050801@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=khoroshilov@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
/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).