Skip to contentSkip to conversation

fddi: 64 bit bug in smt_add_para()

PATCH In review Dan Carpenter 2 participants 2 messages Sep 1, 2012 – Sep 2, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fddi: 64 bit bug in smt_add_para()

The intent was to set 4 bytes of data so that's why the sp_len is set to 4 on the next line. The cast to u_long pointer clears 8 bytes on 64 bit arches.

---
Code auditing work. I don't have this hardware. This bug is old.

drivers/net/fddi/skfp/pmf.c +1 -1
index 24d8566..441b4dc 100644
@@ -673,7 +673,7 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
 			sm_pm_get_ls(smc,port_to_mib(smc,port))) ;
 		break ;
 	case SMT_P_REASON :
-		* (u_long *) to = 0 ;
+		*(u32 *)to = 0 ;
 		sp_len = 4 ;
 		goto sp_done ;
 	case SMT_P1033 :			/* time stamp */
maintainer
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Sat, 1 Sep 2012 12:57:40 -0700

Quoted 5 lines

The intent was to set 4 bytes of data so that's why the sp_len is set to 4 on the next line. The cast to u_long pointer clears 8 bytes on 64 bit arches.

Obvious enough, applied, thanks Dan.