efi/gop: Fix memory leak in __gop_query32/64()
authorArvind Sankar <nivedita@alum.mit.edu>
Fri, 6 Dec 2019 16:55:40 +0000 (16:55 +0000)
committerIngo Molnar <mingo@kernel.org>
Sun, 8 Dec 2019 11:42:18 +0000 (12:42 +0100)
commitff397be685e410a59c34b21ce0c55d4daa466bb7
tree2c1e66fc2ee2a256b06664127f1bb2236fd25e45
parentdbd89c303b4420f6cdb689fd398349fc83b059dd
efi/gop: Fix memory leak in __gop_query32/64()

efi_graphics_output_protocol::query_mode() returns info in
callee-allocated memory which must be freed by the caller, which
we aren't doing.

We don't actually need to call query_mode() in order to obtain the
info for the current graphics mode, which is already there in
gop->mode->info, so just access it directly in the setup_gop32/64()
functions.

Also nothing uses the size of the info structure, so don't update the
passed-in size (which is the size of the gop_handle table in bytes)
unnecessarily.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Bhupesh Sharma <bhsharma@redhat.com>
Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20191206165542.31469-5-ardb@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
drivers/firmware/efi/libstub/gop.c