Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4d4e9907
Commit
4d4e9907
authored
Jun 22, 2016
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/bios: guard against out-of-bounds accesses to image
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
1fe8c02f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h
+3
-4
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
+34
-0
No files found.
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h
View file @
4d4e9907
...
...
@@ -22,10 +22,9 @@ struct nvkm_bios {
u8
nvbios_checksum
(
const
u8
*
data
,
int
size
);
u16
nvbios_findstr
(
const
u8
*
data
,
int
size
,
const
char
*
str
,
int
len
);
int
nvbios_memcmp
(
struct
nvkm_bios
*
,
u32
addr
,
const
char
*
,
u32
len
);
#define nvbios_rd08(b,o) (b)->data[(o)]
#define nvbios_rd16(b,o) get_unaligned_le16(&(b)->data[(o)])
#define nvbios_rd32(b,o) get_unaligned_le32(&(b)->data[(o)])
u8
nvbios_rd08
(
struct
nvkm_bios
*
,
u32
addr
);
u16
nvbios_rd16
(
struct
nvkm_bios
*
,
u32
addr
);
u32
nvbios_rd32
(
struct
nvkm_bios
*
,
u32
addr
);
int
nvkm_bios_new
(
struct
nvkm_device
*
,
int
,
struct
nvkm_bios
**
);
#endif
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
View file @
4d4e9907
...
...
@@ -27,6 +27,40 @@
#include <subdev/bios/bmp.h>
#include <subdev/bios/bit.h>
static
bool
nvbios_addr
(
struct
nvkm_bios
*
bios
,
u32
*
addr
,
u8
size
)
{
if
(
unlikely
(
*
addr
+
size
>=
bios
->
size
))
{
nvkm_error
(
&
bios
->
subdev
,
"OOB %d %08x
\n
"
,
size
,
*
addr
);
return
false
;
}
return
true
;
}
u8
nvbios_rd08
(
struct
nvkm_bios
*
bios
,
u32
addr
)
{
if
(
likely
(
nvbios_addr
(
bios
,
&
addr
,
1
)))
return
bios
->
data
[
addr
];
return
0x00
;
}
u16
nvbios_rd16
(
struct
nvkm_bios
*
bios
,
u32
addr
)
{
if
(
likely
(
nvbios_addr
(
bios
,
&
addr
,
2
)))
return
get_unaligned_le16
(
&
bios
->
data
[
addr
]);
return
0x0000
;
}
u32
nvbios_rd32
(
struct
nvkm_bios
*
bios
,
u32
addr
)
{
if
(
likely
(
nvbios_addr
(
bios
,
&
addr
,
4
)))
return
get_unaligned_le32
(
&
bios
->
data
[
addr
]);
return
0x00000000
;
}
u8
nvbios_checksum
(
const
u8
*
data
,
int
size
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment