summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1999-08-24 00:38:52 +0000
committerbde <bde@FreeBSD.org>1999-08-24 00:38:52 +0000
commitb01c8d2acc506c4737e1d158573e68ce3baa29aa (patch)
tree9d2e6e1ca9a3c02ecba092b446311be56c01f7a7
parent50fccdce5e1c4fc0fbe5b921d8d1fc2823474a7b (diff)
downloadFreeBSD-src-b01c8d2acc506c4737e1d158573e68ce3baa29aa.zip
FreeBSD-src-b01c8d2acc506c4737e1d158573e68ce3baa29aa.tar.gz
Cast pointers to uintptr_t instead of casting them to u_long. They
are still converted to u_long by assignment of the uintptr_t, and address calculations are still done using u_long. This is OK for currently supported machines, but addresses should be represented by vm_offset_t or uintptr_t in case pointers are longer than longs. "Fixed" size of linker_path[]. MAXPATHLEN + 1 was 1 too large for search paths with only one file path in them, but much too small for search paths with several long file paths in them.
-rw-r--r--sys/kern/kern_linker.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 4d2576f..26c1f6b 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_linker.c,v 1.34 1999/07/01 13:21:39 peter Exp $
+ * $Id: kern_linker.c,v 1.35 1999/08/20 00:18:07 grog Exp $
*/
#include "opt_ddb.h"
@@ -592,7 +592,7 @@ int
linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
{
linker_file_t lf;
- u_long off = (u_long)value;
+ u_long off = (uintptr_t)value;
u_long diff, bestdiff;
c_linker_sym_t best;
c_linker_sym_t es;
@@ -860,7 +860,7 @@ kldsym(struct proc *p, struct kldsym_args *uap)
}
if (lf->ops->lookup_symbol(lf, symstr, &sym) == 0 &&
lf->ops->symbol_values(lf, sym, &symval) == 0) {
- lookup.symvalue = (u_long)symval.value;
+ lookup.symvalue = (uintptr_t)symval.value;
lookup.symsize = symval.size;
error = copyout(&lookup, SCARG(uap, data), sizeof(lookup));
} else
@@ -869,7 +869,7 @@ kldsym(struct proc *p, struct kldsym_args *uap)
for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
if (lf->ops->lookup_symbol(lf, symstr, &sym) == 0 &&
lf->ops->symbol_values(lf, sym, &symval) == 0) {
- lookup.symvalue = (u_long)symval.value;
+ lookup.symvalue = (uintptr_t)symval.value;
lookup.symsize = symval.size;
error = copyout(&lookup, SCARG(uap, data), sizeof(lookup));
break;
@@ -971,7 +971,7 @@ SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, 0);
* character as a separator to be consistent with the bootloader.
*/
-static char linker_path[MAXPATHLEN + 1] = "/;/boot/;/modules/";
+static char linker_path[MAXPATHLEN] = "/;/boot/;/modules/";
SYSCTL_STRING(_kern, OID_AUTO, module_path, CTLFLAG_RW, linker_path,
sizeof(linker_path), "module load search path");
OpenPOWER on IntegriCloud