2016-10-18 14:33:36

by Matt Fleming

[permalink] [raw]
Subject: [GIT PULL 0/8] EFI changes for v4.10

Folks, please queue up the following small changes for v4.10.

Note that there is a patch to MAINTAINERS in this pull request that
adds Ard as EFI co-maintainer. It'd probably be a good idea to send
that to Linus before v4.10.

The following changes since commit 92dc33501bfba74655dbf3ec63ea82d040fd6d58:

x86/efi: Round EFI memmap reservations to EFI_PAGE_SIZE (2016-09-20 15:43:31 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-next

for you to fetch changes up to a8226a73b82256b82c167956b0f4d3cd39312531:

efi: efivar_ssdt_load: Don't return success on allocation failure (2016-10-13 11:55:40 +0100)

----------------------------------------------------------------
* Add Ard as EFI co-maintainer in MAINTAINERS

* Misc cleanups for efi_test driver - Ivan Hu and Wei Yongjun

* Fix an early_memremap() leak for ARM/arm64 - Yisheng Xie

* Return an error code on failure instead of success in
efivar_ssdt_load() - Dan Carpenter

* Expose EFI framebuffer configuration, which allows rendering
localized status strings during firmware updates - Peter Jones

----------------------------------------------------------------
Ard Biesheuvel (1):
MAINTAINERS: add myself as EFI maintainer

Dan Carpenter (1):
efi: efivar_ssdt_load: Don't return success on allocation failure

Ivan Hu (3):
efi/efi_test: Fix the uninitialized value datasize
efi/efi_test: Fix the uninitialized value rv
efi/efi_test: Use memdup_user() as a cleanup

Peter Jones (1):
efifb: show framebuffer layout as device attributes

Wei Yongjun (1):
efi: Remove unused including <linux/version.h>

Yisheng Xie (1):
efi/arm*: efi_init() error handling fix

MAINTAINERS | 3 +-
drivers/firmware/efi/arm-init.c | 4 ++-
drivers/firmware/efi/efi.c | 4 ++-
drivers/firmware/efi/test/efi_test.c | 15 +++------
drivers/video/fbdev/efifb.c | 59 ++++++++++++++++++++++++++++--------
5 files changed, 59 insertions(+), 26 deletions(-)


2016-10-18 14:33:47

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 1/8] MAINTAINERS: add myself as EFI maintainer

From: Ard Biesheuvel <[email protected]>

At the request of Matt, I am taking up co-maintainership of the EFI
subsystem. So add my name to the EFI section in MAINTAINERS, and
change the SCM tree reference to point to the new shared Git repo.

Cc: Matt Fleming <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Acked-by: Will Deacon <[email protected]>
Acked-by: Matt Fleming <[email protected]>
---
MAINTAINERS | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 007d05acbb5f..224518556a84 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4557,8 +4557,9 @@ F: sound/usb/misc/ua101.c

EXTENSIBLE FIRMWARE INTERFACE (EFI)
M: Matt Fleming <[email protected]>
+M: Ard Biesheuvel <[email protected]>
L: [email protected]
-T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
S: Maintained
F: Documentation/efi-stub.txt
F: arch/ia64/kernel/efi.c
--
2.10.0

2016-10-18 14:33:59

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 2/8] efi: Remove unused including <linux/version.h>

From: Wei Yongjun <[email protected]>

Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index f61bb52be318..ae51268737cc 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -8,7 +8,6 @@
*
*/

-#include <linux/version.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/init.h>
--
2.10.0

2016-10-18 14:34:12

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 6/8] efi/efi_test: Use memdup_user() as a cleanup

From: Ivan Hu <[email protected]>

Fix coccicheck warning which recommends to use memdup_user()

This patch fixes below coccicheck warnings:
drivers/firmware/efi/test/efi_test.c:269:8-15: WARNING opportunity for
memdup_user

Signed-off-by: Ivan Hu <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index bb26e12b0cfd..8cd578f62059 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -265,14 +265,10 @@ static long efi_runtime_set_variable(unsigned long arg)
return rv;
}

- data = kmalloc(setvariable.data_size, GFP_KERNEL);
- if (!data) {
+ data = memdup_user(setvariable.data, setvariable.data_size);
+ if (IS_ERR(data)) {
kfree(name);
- return -ENOMEM;
- }
- if (copy_from_user(data, setvariable.data, setvariable.data_size)) {
- rv = -EFAULT;
- goto out;
+ return PTR_ERR(data);
}

status = efi.set_variable(name, &vendor_guid,
--
2.10.0

2016-10-18 14:34:24

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 4/8] efi/efi_test: Fix the uninitialized value datasize

From: Ivan Hu <[email protected]>

Fix the minor issue found by CoverityScan
CID 1358931 (#1 of 1): Uninitialized scalar variable (UNINIT)9.
uninit_use: Using uninitialized value datasize.
199 prev_datasize = datasize;
200 status = efi.get_variable(name, vd, at, dz, data);

Signed-off-by: Ivan Hu <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index ae51268737cc..348efc9cf59f 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -155,7 +155,7 @@ static long efi_runtime_get_variable(unsigned long arg)
{
struct efi_getvariable __user *getvariable_user;
struct efi_getvariable getvariable;
- unsigned long datasize, prev_datasize, *dz;
+ unsigned long datasize = 0, prev_datasize, *dz;
efi_guid_t vendor_guid, *vd = NULL;
efi_status_t status;
efi_char16_t *name = NULL;
--
2.10.0

2016-10-18 14:35:20

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 7/8] efifb: show framebuffer layout as device attributes

From: Peter Jones <[email protected]>

Userland sometimes needs to know what the framebuffer configuration was
when the firmware was running. This enables us to render localized
status strings during firmware updates using the data from the ACPI BGRT
table and the protocol described at the url below:

https://msdn.microsoft.com/en-us/windows/hardware/drivers/bringup/boot-screen-components

This patch also fixes up efifb's printk() usage to use pr_warn() /
pr_info() / pr_err() instead.

Signed-off-by: Peter Jones <[email protected]>
Tested-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
---
drivers/video/fbdev/efifb.c | 59 +++++++++++++++++++++++++++++++++++----------
1 file changed, 46 insertions(+), 13 deletions(-)

diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 924bad45c176..099b76b3e8b6 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -118,6 +118,31 @@ static inline bool fb_base_is_valid(void)
return false;
}

+#define efifb_attr_decl(name, fmt) \
+static ssize_t name##_show(struct device *dev, \
+ struct device_attribute *attr, \
+ char *buf) \
+{ \
+ return sprintf(buf, fmt "\n", (screen_info.lfb_##name)); \
+} \
+static DEVICE_ATTR_RO(name)
+
+efifb_attr_decl(base, "0x%x");
+efifb_attr_decl(linelength, "%u");
+efifb_attr_decl(height, "%u");
+efifb_attr_decl(width, "%u");
+efifb_attr_decl(depth, "%u");
+
+static struct attribute *efifb_attrs[] = {
+ &dev_attr_base.attr,
+ &dev_attr_linelength.attr,
+ &dev_attr_width.attr,
+ &dev_attr_height.attr,
+ &dev_attr_depth.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(efifb);
+
static int efifb_probe(struct platform_device *dev)
{
struct fb_info *info;
@@ -205,14 +230,13 @@ static int efifb_probe(struct platform_device *dev)
} else {
/* We cannot make this fatal. Sometimes this comes from magic
spaces our resource handlers simply don't know about */
- printk(KERN_WARNING
- "efifb: cannot reserve video memory at 0x%lx\n",
+ pr_warn("efifb: cannot reserve video memory at 0x%lx\n",
efifb_fix.smem_start);
}

info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
if (!info) {
- printk(KERN_ERR "efifb: cannot allocate framebuffer\n");
+ pr_err("efifb: cannot allocate framebuffer\n");
err = -ENOMEM;
goto err_release_mem;
}
@@ -230,16 +254,15 @@ static int efifb_probe(struct platform_device *dev)

info->screen_base = ioremap_wc(efifb_fix.smem_start, efifb_fix.smem_len);
if (!info->screen_base) {
- printk(KERN_ERR "efifb: abort, cannot ioremap video memory "
- "0x%x @ 0x%lx\n",
+ pr_err("efifb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n",
efifb_fix.smem_len, efifb_fix.smem_start);
err = -EIO;
goto err_release_fb;
}

- printk(KERN_INFO "efifb: framebuffer at 0x%lx, using %dk, total %dk\n",
+ pr_info("efifb: framebuffer at 0x%lx, using %dk, total %dk\n",
efifb_fix.smem_start, size_remap/1024, size_total/1024);
- printk(KERN_INFO "efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
+ pr_info("efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
efifb_defined.xres, efifb_defined.yres,
efifb_defined.bits_per_pixel, efifb_fix.line_length,
screen_info.pages);
@@ -247,7 +270,7 @@ static int efifb_probe(struct platform_device *dev)
efifb_defined.xres_virtual = efifb_defined.xres;
efifb_defined.yres_virtual = efifb_fix.smem_len /
efifb_fix.line_length;
- printk(KERN_INFO "efifb: scrolling: redraw\n");
+ pr_info("efifb: scrolling: redraw\n");
efifb_defined.yres_virtual = efifb_defined.yres;

/* some dummy values for timing to make fbset happy */
@@ -265,7 +288,7 @@ static int efifb_probe(struct platform_device *dev)
efifb_defined.transp.offset = screen_info.rsvd_pos;
efifb_defined.transp.length = screen_info.rsvd_size;

- printk(KERN_INFO "efifb: %s: "
+ pr_info("efifb: %s: "
"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
"Truecolor",
screen_info.rsvd_size,
@@ -285,12 +308,19 @@ static int efifb_probe(struct platform_device *dev)
info->fix = efifb_fix;
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;

- if ((err = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) {
- printk(KERN_ERR "efifb: cannot allocate colormap\n");
+ err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
+ if (err) {
+ pr_err("efifb: cannot add sysfs attrs\n");
goto err_unmap;
}
- if ((err = register_framebuffer(info)) < 0) {
- printk(KERN_ERR "efifb: cannot register framebuffer\n");
+ err = fb_alloc_cmap(&info->cmap, 256, 0);
+ if (err < 0) {
+ pr_err("efifb: cannot allocate colormap\n");
+ goto err_groups;
+ }
+ err = register_framebuffer(info);
+ if (err < 0) {
+ pr_err("efifb: cannot register framebuffer\n");
goto err_fb_dealoc;
}
fb_info(info, "%s frame buffer device\n", info->fix.id);
@@ -298,6 +328,8 @@ static int efifb_probe(struct platform_device *dev)

err_fb_dealoc:
fb_dealloc_cmap(&info->cmap);
+err_groups:
+ sysfs_remove_groups(&dev->dev.kobj, efifb_groups);
err_unmap:
iounmap(info->screen_base);
err_release_fb:
@@ -313,6 +345,7 @@ static int efifb_remove(struct platform_device *pdev)
struct fb_info *info = platform_get_drvdata(pdev);

unregister_framebuffer(info);
+ sysfs_remove_groups(&pdev->dev.kobj, efifb_groups);
framebuffer_release(info);

return 0;
--
2.10.0

2016-10-18 14:35:18

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 8/8] efi: efivar_ssdt_load: Don't return success on allocation failure

From: Dan Carpenter <[email protected]>

We should return -ENOMEM here, instead of success.

Fixes: 475fb4e8b2f4 ("efi / ACPI: load SSTDs from EFI variables")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
---
drivers/firmware/efi/efi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 1ac199cd75e7..a4944e22f294 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -259,8 +259,10 @@ static __init int efivar_ssdt_load(void)
}

data = kmalloc(size, GFP_KERNEL);
- if (!data)
+ if (!data) {
+ ret = -ENOMEM;
goto free_entry;
+ }

ret = efivar_entry_get(entry, NULL, &size, data);
if (ret) {
--
2.10.0

2016-10-18 14:35:15

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 3/8] efi/arm*: efi_init() error handling fix

From: Yisheng Xie <[email protected]>

There's an early memmap leak in efi_init error path, fix it.

Signed-off-by: Yisheng Xie <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
---
drivers/firmware/efi/arm-init.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index 8efe13075c92..f853ad2c4ca0 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -244,8 +244,10 @@ void __init efi_init(void)
"Unexpected EFI_MEMORY_DESCRIPTOR version %ld",
efi.memmap.desc_version);

- if (uefi_init() < 0)
+ if (uefi_init() < 0) {
+ efi_memmap_unmap();
return;
+ }

reserve_regions();
efi_memattr_init();
--
2.10.0

2016-10-18 14:34:39

by Matt Fleming

[permalink] [raw]
Subject: [PATCH 5/8] efi/efi_test: Fix the uninitialized value rv

From: Ivan Hu <[email protected]>

Fix the minor issue found by CoverityScan
520 kfree(name);
CID 1358932 (#1 of 1): Uninitialized scalar variable (UNINIT)17.
uninit_use: Using uninitialized value rv.
521 return rv;
522}

Signed-off-by: Ivan Hu <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index 348efc9cf59f..bb26e12b0cfd 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -428,7 +428,7 @@ static long efi_runtime_get_nextvariablename(unsigned long arg)
efi_guid_t *vd = NULL;
efi_guid_t vendor_guid;
efi_char16_t *name = NULL;
- int rv;
+ int rv = 0;

getnextvariablename_user = (struct efi_getnextvariablename __user *)arg;

--
2.10.0

2016-10-18 15:26:15

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL 0/8] EFI changes for v4.10


* Matt Fleming <[email protected]> wrote:

> Folks, please queue up the following small changes for v4.10.

Applied, thanks Matt!

> Note that there is a patch to MAINTAINERS in this pull request that
> adds Ard as EFI co-maintainer. It'd probably be a good idea to send
> that to Linus before v4.10.

Ok, queued that for efi/urgent.

Thanks,

Ingo

2016-10-18 15:29:43

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [GIT PULL 0/8] EFI changes for v4.10

On 18 October 2016 at 16:25, Ingo Molnar <[email protected]> wrote:
>
> * Matt Fleming <[email protected]> wrote:
>
>> Folks, please queue up the following small changes for v4.10.
>
> Applied, thanks Matt!
>
>> Note that there is a patch to MAINTAINERS in this pull request that
>> adds Ard as EFI co-maintainer. It'd probably be a good idea to send
>> that to Linus before v4.10.
>
> Ok, queued that for efi/urgent.
>

Thanks. Before you pass that on, though, I have an other patch to go
on top. Will send that out in a minute

Cheers,
Ard.

Subject: [tip:efi/core] MAINTAINERS: Add myself as EFI maintainer

Commit-ID: 6026ed2fe258b61ea5aadd91a95c4f36a6dbe167
Gitweb: http://git.kernel.org/tip/6026ed2fe258b61ea5aadd91a95c4f36a6dbe167
Author: Ard Biesheuvel <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:11 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:14 +0200

MAINTAINERS: Add myself as EFI maintainer

At the request of Matt, I am taking up co-maintainership of the EFI
subsystem. So add my name to the EFI section in MAINTAINERS, and
change the SCM tree reference to point to the new shared Git repo.

Signed-off-by: Ard Biesheuvel <[email protected]>
Acked-by: Will Deacon <[email protected]>
Acked-by: Matt Fleming <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
MAINTAINERS | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1cd38a7..6847ba8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4620,8 +4620,9 @@ F: sound/usb/misc/ua101.c

EXTENSIBLE FIRMWARE INTERFACE (EFI)
M: Matt Fleming <[email protected]>
+M: Ard Biesheuvel <[email protected]>
L: [email protected]
-T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
S: Maintained
F: Documentation/efi-stub.txt
F: arch/ia64/kernel/efi.c

Subject: [tip:efi/core] efi/efi_test: Fix uninitialized variable 'datasize'

Commit-ID: 46b9b7135332d1e2c54e853108a5088ab28f2165
Gitweb: http://git.kernel.org/tip/46b9b7135332d1e2c54e853108a5088ab28f2165
Author: Ivan Hu <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:14 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:17 +0200

efi/efi_test: Fix uninitialized variable 'datasize'

Fix minor issue found by CoverityScan:

CID 1358931 (#1 of 1): Uninitialized scalar variable (UNINIT)9.
uninit_use: Using uninitialized value datasize.
199 prev_datasize = datasize;
200 status = efi.get_variable(name, vd, at, dz, data);

Signed-off-by: Ivan Hu <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index ae51268..348efc9 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -155,7 +155,7 @@ static long efi_runtime_get_variable(unsigned long arg)
{
struct efi_getvariable __user *getvariable_user;
struct efi_getvariable getvariable;
- unsigned long datasize, prev_datasize, *dz;
+ unsigned long datasize = 0, prev_datasize, *dz;
efi_guid_t vendor_guid, *vd = NULL;
efi_status_t status;
efi_char16_t *name = NULL;

Subject: [tip:efi/core] efi: Remove unused include of <linux/version.h>

Commit-ID: 10714dd37aa7ebb165677b9a793448950ff366ad
Gitweb: http://git.kernel.org/tip/10714dd37aa7ebb165677b9a793448950ff366ad
Author: Wei Yongjun <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:12 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:16 +0200

efi: Remove unused include of <linux/version.h>

Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index f61bb52..ae51268 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -8,7 +8,6 @@
*
*/

-#include <linux/version.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/init.h>

Subject: [tip:efi/core] efi/efi_test: Fix uninitialized variable 'rv'

Commit-ID: 9c30a2199311df9a1f25d0586c96dfbb7e876cdf
Gitweb: http://git.kernel.org/tip/9c30a2199311df9a1f25d0586c96dfbb7e876cdf
Author: Ivan Hu <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:15 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:18 +0200

efi/efi_test: Fix uninitialized variable 'rv'

Fix minor issue found by CoverityScan:

520 kfree(name);
CID 1358932 (#1 of 1): Uninitialized scalar variable (UNINIT)17.
uninit_use: Using uninitialized value rv.
521 return rv;
522}

Signed-off-by: Ivan Hu <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index 348efc9..bb26e12 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -428,7 +428,7 @@ static long efi_runtime_get_nextvariablename(unsigned long arg)
efi_guid_t *vd = NULL;
efi_guid_t vendor_guid;
efi_char16_t *name = NULL;
- int rv;
+ int rv = 0;

getnextvariablename_user = (struct efi_getnextvariablename __user *)arg;


Subject: [tip:efi/core] efi/arm*: Fix efi_init() error handling

Commit-ID: 0709a008c9fadc176500ece7395b8b5b8de143e3
Gitweb: http://git.kernel.org/tip/0709a008c9fadc176500ece7395b8b5b8de143e3
Author: Yisheng Xie <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:13 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:17 +0200

efi/arm*: Fix efi_init() error handling

There's an early memmap() leak in the efi_init() error path, fix it.

Signed-off-by: Yisheng Xie <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/firmware/efi/arm-init.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index 8efe130..f853ad2 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -244,8 +244,10 @@ void __init efi_init(void)
"Unexpected EFI_MEMORY_DESCRIPTOR version %ld",
efi.memmap.desc_version);

- if (uefi_init() < 0)
+ if (uefi_init() < 0) {
+ efi_memmap_unmap();
return;
+ }

reserve_regions();
efi_memattr_init();

Subject: [tip:efi/core] efi/efi_test: Use memdup_user() as a cleanup

Commit-ID: c208ed916e587048ba6b69840d08324100d7d325
Gitweb: http://git.kernel.org/tip/c208ed916e587048ba6b69840d08324100d7d325
Author: Ivan Hu <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:16 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:19 +0200

efi/efi_test: Use memdup_user() as a cleanup

Fix coccicheck warning which recommends to use memdup_user().

This patch fixes the following coccicheck warnings:

drivers/firmware/efi/test/efi_test.c:269:8-15: WARNING opportunity for memdup_user

Signed-off-by: Ivan Hu <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/firmware/efi/test/efi_test.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index bb26e12..8cd578f 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -265,14 +265,10 @@ static long efi_runtime_set_variable(unsigned long arg)
return rv;
}

- data = kmalloc(setvariable.data_size, GFP_KERNEL);
- if (!data) {
+ data = memdup_user(setvariable.data, setvariable.data_size);
+ if (IS_ERR(data)) {
kfree(name);
- return -ENOMEM;
- }
- if (copy_from_user(data, setvariable.data, setvariable.data_size)) {
- rv = -EFAULT;
- goto out;
+ return PTR_ERR(data);
}

status = efi.set_variable(name, &vendor_guid,

Subject: [tip:efi/core] efifb: Show framebuffer layout as device attributes

Commit-ID: 753375a881caa01112b7cec2c796749154e0bb23
Gitweb: http://git.kernel.org/tip/753375a881caa01112b7cec2c796749154e0bb23
Author: Peter Jones <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:17 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:19 +0200

efifb: Show framebuffer layout as device attributes

Userland sometimes needs to know what the framebuffer configuration was
when the firmware was running. This enables us to render localized
status strings during firmware updates using the data from the ACPI BGRT
table and the protocol described at the url below:

https://msdn.microsoft.com/en-us/windows/hardware/drivers/bringup/boot-screen-components

This patch also fixes up efifb's printk() usage to use pr_warn() /
pr_info() / pr_err() instead.

Tested-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Peter Jones <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/video/fbdev/efifb.c | 59 +++++++++++++++++++++++++++++++++++----------
1 file changed, 46 insertions(+), 13 deletions(-)

diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 37a37c4..8c4dc1e 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -118,6 +118,31 @@ static inline bool fb_base_is_valid(void)
return false;
}

+#define efifb_attr_decl(name, fmt) \
+static ssize_t name##_show(struct device *dev, \
+ struct device_attribute *attr, \
+ char *buf) \
+{ \
+ return sprintf(buf, fmt "\n", (screen_info.lfb_##name)); \
+} \
+static DEVICE_ATTR_RO(name)
+
+efifb_attr_decl(base, "0x%x");
+efifb_attr_decl(linelength, "%u");
+efifb_attr_decl(height, "%u");
+efifb_attr_decl(width, "%u");
+efifb_attr_decl(depth, "%u");
+
+static struct attribute *efifb_attrs[] = {
+ &dev_attr_base.attr,
+ &dev_attr_linelength.attr,
+ &dev_attr_width.attr,
+ &dev_attr_height.attr,
+ &dev_attr_depth.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(efifb);
+
static int efifb_probe(struct platform_device *dev)
{
struct fb_info *info;
@@ -205,14 +230,13 @@ static int efifb_probe(struct platform_device *dev)
} else {
/* We cannot make this fatal. Sometimes this comes from magic
spaces our resource handlers simply don't know about */
- printk(KERN_WARNING
- "efifb: cannot reserve video memory at 0x%lx\n",
+ pr_warn("efifb: cannot reserve video memory at 0x%lx\n",
efifb_fix.smem_start);
}

info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
if (!info) {
- printk(KERN_ERR "efifb: cannot allocate framebuffer\n");
+ pr_err("efifb: cannot allocate framebuffer\n");
err = -ENOMEM;
goto err_release_mem;
}
@@ -230,16 +254,15 @@ static int efifb_probe(struct platform_device *dev)

info->screen_base = ioremap_wc(efifb_fix.smem_start, efifb_fix.smem_len);
if (!info->screen_base) {
- printk(KERN_ERR "efifb: abort, cannot ioremap video memory "
- "0x%x @ 0x%lx\n",
+ pr_err("efifb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n",
efifb_fix.smem_len, efifb_fix.smem_start);
err = -EIO;
goto err_release_fb;
}

- printk(KERN_INFO "efifb: framebuffer at 0x%lx, using %dk, total %dk\n",
+ pr_info("efifb: framebuffer at 0x%lx, using %dk, total %dk\n",
efifb_fix.smem_start, size_remap/1024, size_total/1024);
- printk(KERN_INFO "efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
+ pr_info("efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
efifb_defined.xres, efifb_defined.yres,
efifb_defined.bits_per_pixel, efifb_fix.line_length,
screen_info.pages);
@@ -247,7 +270,7 @@ static int efifb_probe(struct platform_device *dev)
efifb_defined.xres_virtual = efifb_defined.xres;
efifb_defined.yres_virtual = efifb_fix.smem_len /
efifb_fix.line_length;
- printk(KERN_INFO "efifb: scrolling: redraw\n");
+ pr_info("efifb: scrolling: redraw\n");
efifb_defined.yres_virtual = efifb_defined.yres;

/* some dummy values for timing to make fbset happy */
@@ -265,7 +288,7 @@ static int efifb_probe(struct platform_device *dev)
efifb_defined.transp.offset = screen_info.rsvd_pos;
efifb_defined.transp.length = screen_info.rsvd_size;

- printk(KERN_INFO "efifb: %s: "
+ pr_info("efifb: %s: "
"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
"Truecolor",
screen_info.rsvd_size,
@@ -285,12 +308,19 @@ static int efifb_probe(struct platform_device *dev)
info->fix = efifb_fix;
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;

- if ((err = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) {
- printk(KERN_ERR "efifb: cannot allocate colormap\n");
+ err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
+ if (err) {
+ pr_err("efifb: cannot add sysfs attrs\n");
goto err_unmap;
}
- if ((err = register_framebuffer(info)) < 0) {
- printk(KERN_ERR "efifb: cannot register framebuffer\n");
+ err = fb_alloc_cmap(&info->cmap, 256, 0);
+ if (err < 0) {
+ pr_err("efifb: cannot allocate colormap\n");
+ goto err_groups;
+ }
+ err = register_framebuffer(info);
+ if (err < 0) {
+ pr_err("efifb: cannot register framebuffer\n");
goto err_fb_dealoc;
}
fb_info(info, "%s frame buffer device\n", info->fix.id);
@@ -298,6 +328,8 @@ static int efifb_probe(struct platform_device *dev)

err_fb_dealoc:
fb_dealloc_cmap(&info->cmap);
+err_groups:
+ sysfs_remove_groups(&dev->dev.kobj, efifb_groups);
err_unmap:
iounmap(info->screen_base);
err_release_fb:
@@ -313,6 +345,7 @@ static int efifb_remove(struct platform_device *pdev)
struct fb_info *info = platform_get_drvdata(pdev);

unregister_framebuffer(info);
+ sysfs_remove_groups(&pdev->dev.kobj, efifb_groups);
framebuffer_release(info);

return 0;

Subject: [tip:efi/core] efi/efivar_ssdt_load: Don't return success on allocation failure

Commit-ID: a75dcb5848359f488c32c0aef8711d9bd37a77b8
Gitweb: http://git.kernel.org/tip/a75dcb5848359f488c32c0aef8711d9bd37a77b8
Author: Dan Carpenter <[email protected]>
AuthorDate: Tue, 18 Oct 2016 15:33:18 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Oct 2016 17:11:20 +0200

efi/efivar_ssdt_load: Don't return success on allocation failure

We should return -ENOMEM here, instead of success.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Fixes: 475fb4e8b2f4 ("efi / ACPI: load SSTDs from EFI variables")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/firmware/efi/efi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 1ac199c..a4944e2 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -259,8 +259,10 @@ static __init int efivar_ssdt_load(void)
}

data = kmalloc(size, GFP_KERNEL);
- if (!data)
+ if (!data) {
+ ret = -ENOMEM;
goto free_entry;
+ }

ret = efivar_entry_get(entry, NULL, &size, data);
if (ret) {

2016-10-18 15:34:20

by Lukas Wunner

[permalink] [raw]
Subject: Re: [GIT PULL 0/8] EFI changes for v4.10

On Tue, Oct 18, 2016 at 03:33:10PM +0100, Matt Fleming wrote:
> Folks, please queue up the following small changes for v4.10.

These are all fixes. Did you mean 4.9? Ingo only queued up
the MAINTAINERS patch for 4.9 now, the rest for 4.10.

Lukas

2016-10-18 15:40:30

by Matt Fleming

[permalink] [raw]
Subject: Re: [GIT PULL 0/8] EFI changes for v4.10

On Tue, 18 Oct, at 05:34:36PM, Lukas Wunner wrote:
> On Tue, Oct 18, 2016 at 03:33:10PM +0100, Matt Fleming wrote:
> > Folks, please queue up the following small changes for v4.10.
>
> These are all fixes. Did you mean 4.9? Ingo only queued up
> the MAINTAINERS patch for 4.9 now, the rest for 4.10.

No, I meant v4.10. They are not all fixes, some are new features (like
the framebuffer changes from Peter) and none of them are critical
fixes that would warrant being merged into urgent.