In dvd_read_disckey, sizeof(buf) is no longer '4 + 2048' after the

malloc change. Replace 'sizeof(buf)' with '4 + 2048' -- this makes
dvd_read_disckey work properly again.
This commit is contained in:
jmcneill 2002-12-15 17:43:50 +00:00
parent dc89e919cf
commit 675603655c
1 changed files with 5 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.171 2002/12/15 01:55:44 fvdl Exp $ */
/* $NetBSD: cd.c,v 1.172 2002/12/15 17:43:50 jmcneill Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.171 2002/12/15 01:55:44 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.172 2002/12/15 17:43:50 jmcneill Exp $");
#include "rnd.h"
@ -2053,17 +2053,16 @@ dvd_read_disckey(cd, s)
u_int8_t *buf;
int error;
buf = malloc(4 + 2048, M_TEMP, M_WAITOK);
buf = malloc(4 + 2048, M_TEMP, M_WAITOK|M_ZERO);
if (buf == NULL)
return EIO;
memset(cmd.bytes, 0, 15);
memset(buf, 0, sizeof(buf));
cmd.opcode = GPCMD_READ_DVD_STRUCTURE;
cmd.bytes[6] = s->type;
_lto2b(sizeof(buf), &cmd.bytes[7]);
_lto2b(4 + 2048, &cmd.bytes[7]);
cmd.bytes[9] = s->disckey.agid << 6;
error = scsipi_command(cd->sc_periph, &cmd, 12, buf, sizeof(buf),
error = scsipi_command(cd->sc_periph, &cmd, 12, buf, 4 + 2048,
CDRETRIES, 30000, NULL, XS_CTL_DATA_IN|XS_CTL_DATA_ONSTACK);
if (error == 0)
memcpy(s->disckey.value, &buf[4], 2048);