git: 32394e97c350 - stable/12 - efihttp_fs_seek() is missing NULL pointer check

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 01:16:31 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=32394e97c350c1837d2c232db54c0bd081351c62

commit 32394e97c350c1837d2c232db54c0bd081351c62
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-02-20 08:53:04 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:58 +0000

    efihttp_fs_seek() is missing NULL pointer check
    
    Add missing check of malloc() result.
    
    (cherry picked from commit 8abc11f65c828a58263e4b4a8eac70fdf7082792)
---
 stand/efi/libefi/efihttp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/stand/efi/libefi/efihttp.c b/stand/efi/libefi/efihttp.c
index 12d445c55b67..074c85dcdef0 100644
--- a/stand/efi/libefi/efihttp.c
+++ b/stand/efi/libefi/efihttp.c
@@ -702,6 +702,8 @@ efihttp_fs_seek(struct open_file *f, off_t offset, int where)
 		return (0);
 	if (where == SEEK_SET && fh->offset < offset) {
 		buf = malloc(1500);
+		if (buf == NULL)
+			return (ENOMEM);
 		res = offset - fh->offset;
 		while (res > 0) {
 			err = _efihttp_fs_read(f, buf, min(1500, res), &res2);