@@ -1138,6 +1138,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1138
1138
{
1139
1139
struct slip * sl = (struct slip * ) tty -> disc_data ;
1140
1140
unsigned int tmp ;
1141
+ int __user * p = (int __user * )arg ;
1141
1142
1142
1143
/* First make sure we're connected. */
1143
1144
if (!sl || sl -> magic != SLIP_MAGIC ) {
@@ -1147,17 +1148,17 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1147
1148
switch (cmd ) {
1148
1149
case SIOCGIFNAME :
1149
1150
tmp = strlen (sl -> dev -> name ) + 1 ;
1150
- if (copy_to_user ((void * )arg , sl -> dev -> name , tmp ))
1151
+ if (copy_to_user ((void __user * )arg , sl -> dev -> name , tmp ))
1151
1152
return - EFAULT ;
1152
1153
return 0 ;
1153
1154
1154
1155
case SIOCGIFENCAP :
1155
- if (put_user (sl -> mode , ( int * ) arg ))
1156
+ if (put_user (sl -> mode , p ))
1156
1157
return - EFAULT ;
1157
1158
return 0 ;
1158
1159
1159
1160
case SIOCSIFENCAP :
1160
- if (get_user (tmp ,( int * ) arg ))
1161
+ if (get_user (tmp , p ))
1161
1162
return - EFAULT ;
1162
1163
#ifndef SL_INCLUDE_CSLIP
1163
1164
if (tmp & (SL_MODE_CSLIP |SL_MODE_ADAPTIVE )) {
@@ -1185,7 +1186,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1185
1186
#ifdef CONFIG_SLIP_SMART
1186
1187
/* VSV changes start here */
1187
1188
case SIOCSKEEPALIVE :
1188
- if (get_user (tmp ,( int * ) arg ))
1189
+ if (get_user (tmp , p ))
1189
1190
return - EFAULT ;
1190
1191
if (tmp > 255 ) /* max for unchar */
1191
1192
return - EINVAL ;
@@ -1205,12 +1206,12 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1205
1206
return 0 ;
1206
1207
1207
1208
case SIOCGKEEPALIVE :
1208
- if (put_user (sl -> keepalive , ( int * ) arg ))
1209
+ if (put_user (sl -> keepalive , p ))
1209
1210
return - EFAULT ;
1210
1211
return 0 ;
1211
1212
1212
1213
case SIOCSOUTFILL :
1213
- if (get_user (tmp ,( int * ) arg ))
1214
+ if (get_user (tmp , p ))
1214
1215
return - EFAULT ;
1215
1216
if (tmp > 255 ) /* max for unchar */
1216
1217
return - EINVAL ;
@@ -1229,7 +1230,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1229
1230
return 0 ;
1230
1231
1231
1232
case SIOCGOUTFILL :
1232
- if (put_user (sl -> outfill , ( int * ) arg ))
1233
+ if (put_user (sl -> outfill , p ))
1233
1234
return - EFAULT ;
1234
1235
return 0 ;
1235
1236
/* VSV changes end */
@@ -1254,6 +1255,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1254
1255
static int sl_ioctl (struct net_device * dev ,struct ifreq * rq ,int cmd )
1255
1256
{
1256
1257
struct slip * sl = (struct slip * )(dev -> priv );
1258
+ unsigned long * p = (unsigned long * )& rq -> ifr_ifru ;
1257
1259
1258
1260
if (sl == NULL ) /* Allocation failed ?? */
1259
1261
return - ENODEV ;
@@ -1268,11 +1270,11 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd)
1268
1270
switch (cmd ){
1269
1271
case SIOCSKEEPALIVE :
1270
1272
/* max for unchar */
1271
- if ((( unsigned int )(( unsigned long ) rq -> ifr_data )) > 255 ) {
1273
+ if ((unsigned ) * p > 255 ) {
1272
1274
spin_unlock_bh (& sl -> lock );
1273
1275
return - EINVAL ;
1274
1276
}
1275
- sl -> keepalive = (unchar ) (( unsigned long ) rq -> ifr_data ) ;
1277
+ sl -> keepalive = (unchar ) * p ;
1276
1278
if (sl -> keepalive != 0 ) {
1277
1279
sl -> keepalive_timer .expires = jiffies + sl -> keepalive * HZ ;
1278
1280
mod_timer (& sl -> keepalive_timer , jiffies + sl -> keepalive * HZ );
@@ -1283,15 +1285,15 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd)
1283
1285
break ;
1284
1286
1285
1287
case SIOCGKEEPALIVE :
1286
- rq -> ifr_data = ( caddr_t )(( unsigned long ) sl -> keepalive ) ;
1288
+ * p = sl -> keepalive ;
1287
1289
break ;
1288
1290
1289
1291
case SIOCSOUTFILL :
1290
- if ((( unsigned )(( unsigned long ) rq -> ifr_data )) > 255 ) { /* max for unchar */
1292
+ if ((unsigned )* p > 255 ) { /* max for unchar */
1291
1293
spin_unlock_bh (& sl -> lock );
1292
1294
return - EINVAL ;
1293
1295
}
1294
- if ((sl -> outfill = (unchar )(( unsigned long ) rq -> ifr_data ) ) != 0 ){
1296
+ if ((sl -> outfill = (unchar )* p ) != 0 ){
1295
1297
mod_timer (& sl -> outfill_timer , jiffies + sl -> outfill * HZ );
1296
1298
set_bit (SLF_OUTWAIT , & sl -> flags );
1297
1299
} else {
@@ -1300,7 +1302,7 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd)
1300
1302
break ;
1301
1303
1302
1304
case SIOCGOUTFILL :
1303
- rq -> ifr_data = ( caddr_t )(( unsigned long ) sl -> outfill ) ;
1305
+ * p = sl -> outfill ;
1304
1306
break ;
1305
1307
1306
1308
case SIOCSLEASE :
@@ -1312,12 +1314,12 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd)
1312
1314
return - EPERM ;
1313
1315
}
1314
1316
sl -> leased = 0 ;
1315
- if (( unsigned long ) rq -> ifr_data )
1317
+ if (* p )
1316
1318
sl -> leased = 1 ;
1317
1319
break ;
1318
1320
1319
1321
case SIOCGLEASE :
1320
- rq -> ifr_data = ( caddr_t )(( unsigned long ) sl -> leased ) ;
1322
+ * p = sl -> leased ;
1321
1323
};
1322
1324
spin_unlock_bh (& sl -> lock );
1323
1325
return 0 ;
0 commit comments