loader: chain load relocate data declaration is bad

The implementation is using fixed size array allocated in asm module,
need to use proper array declaration for C source.

CID:		1376405
Reported by:	Coverity, cem
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D11321
This commit is contained in:
Toomas Soome 2017-06-29 04:33:55 +00:00
parent 86a656deb0
commit ee059e6369
2 changed files with 7 additions and 5 deletions

View file

@ -71,7 +71,10 @@ struct relocate_data {
extern void relocater(void);
extern uint32_t relocater_data;
/*
* The relocater_data[] is fixed size array allocated in relocater_tramp.S
*/
extern struct relocate_data relocater_data[];
extern uint32_t relocater_size;
extern uint16_t relocator_ip;

View file

@ -58,7 +58,6 @@ command_chain(int argc, char *argv[])
int fd, len, size = SECTOR_SIZE;
struct stat st;
vm_offset_t mem = 0x100000;
uint32_t *uintptr = &relocater_data;
struct i386_devdesc *rootdev;
if (argc == 1) {
@ -108,9 +107,9 @@ command_chain(int argc, char *argv[])
return (CMD_ERROR);
}
uintptr[0] = mem;
uintptr[1] = 0x7C00;
uintptr[2] = SECTOR_SIZE;
relocater_data[0].src = mem;
relocater_data[0].dest = 0x7C00;
relocater_data[0].size = SECTOR_SIZE;
relocator_edx = bd_unit2bios(rootdev->d_unit);
relocator_esi = relocater_size;