drivers/net/hamradio/dmascc.c:1238:56: sparse: sparse: non size-preserving pointer to integer cast

From: kernel test robot
Date: Sun Jun 28 2020 - 06:49:42 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 916a3b0fc1206f7e7ae8d00a21a3114b1dc67794
commit: 80591e61a0f7e88deaada69844e4a31280c4a38f kbuild: tell sparse about the $ARCH
date: 8 months ago
config: alpha-randconfig-s031-20200628 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-dirty
git checkout 80591e61a0f7e88deaada69844e4a31280c4a38f
# save the attached .config to linux build tree
make W=1 C=1 ARCH=alpha CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/net/hamradio/dmascc.c:1238:56: sparse: sparse: non size-preserving pointer to integer cast
drivers/net/hamradio/dmascc.c:978:48: sparse: sparse: non size-preserving pointer to integer cast
drivers/net/hamradio/dmascc.c:1025:48: sparse: sparse: non size-preserving pointer to integer cast
drivers/net/hamradio/dmascc.c:1025:48: sparse: sparse: non size-preserving pointer to integer cast

vim +1238 drivers/net/hamradio/dmascc.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 1180
^1da177e4c3f41 Linus Torvalds 2005-04-16 1181
^1da177e4c3f41 Linus Torvalds 2005-04-16 1182 static void special_condition(struct scc_priv *priv, int rc)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1183 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1184 int cb;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1185 unsigned long flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1186
^1da177e4c3f41 Linus Torvalds 2005-04-16 1187 /* See Figure 2-15. Only overrun and EOF need to be checked. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1188
^1da177e4c3f41 Linus Torvalds 2005-04-16 1189 if (rc & Rx_OVR) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1190 /* Receiver overrun */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1191 priv->rx_over = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1192 if (priv->param.dma < 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1193 write_scc(priv, R0, ERR_RES);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1194 } else if (rc & END_FR) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1195 /* End of frame. Get byte count */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1196 if (priv->param.dma >= 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1197 flags = claim_dma_lock();
^1da177e4c3f41 Linus Torvalds 2005-04-16 1198 cb = BUF_SIZE - get_dma_residue(priv->param.dma) -
^1da177e4c3f41 Linus Torvalds 2005-04-16 1199 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1200 release_dma_lock(flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1201 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1202 cb = priv->rx_ptr - 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1203 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1204 if (priv->rx_over) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1205 /* We had an overrun */
13c0582d91ab63 Stephen Hemminger 2009-01-09 1206 priv->dev->stats.rx_errors++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1207 if (priv->rx_over == 2)
13c0582d91ab63 Stephen Hemminger 2009-01-09 1208 priv->dev->stats.rx_length_errors++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1209 else
13c0582d91ab63 Stephen Hemminger 2009-01-09 1210 priv->dev->stats.rx_fifo_errors++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1211 priv->rx_over = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1212 } else if (rc & CRC_ERR) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1213 /* Count invalid CRC only if packet length >= minimum */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1214 if (cb >= 15) {
13c0582d91ab63 Stephen Hemminger 2009-01-09 1215 priv->dev->stats.rx_errors++;
13c0582d91ab63 Stephen Hemminger 2009-01-09 1216 priv->dev->stats.rx_crc_errors++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1217 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1218 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1219 if (cb >= 15) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1220 if (priv->rx_count < NUM_RX_BUF - 1) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1221 /* Put good frame in FIFO */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1222 priv->rx_len[priv->rx_head] = cb;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1223 priv->rx_head =
^1da177e4c3f41 Linus Torvalds 2005-04-16 1224 (priv->rx_head +
^1da177e4c3f41 Linus Torvalds 2005-04-16 1225 1) % NUM_RX_BUF;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1226 priv->rx_count++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1227 schedule_work(&priv->rx_work);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1228 } else {
13c0582d91ab63 Stephen Hemminger 2009-01-09 1229 priv->dev->stats.rx_errors++;
13c0582d91ab63 Stephen Hemminger 2009-01-09 1230 priv->dev->stats.rx_over_errors++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1231 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1232 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1233 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1234 /* Get ready for new frame */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1235 if (priv->param.dma >= 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1236 flags = claim_dma_lock();
^1da177e4c3f41 Linus Torvalds 2005-04-16 1237 set_dma_addr(priv->param.dma,
^1da177e4c3f41 Linus Torvalds 2005-04-16 @1238 (int) priv->rx_buf[priv->rx_head]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1239 set_dma_count(priv->param.dma, BUF_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1240 release_dma_lock(flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1241 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1242 priv->rx_ptr = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1243 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1244 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1245 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1246

:::::: The code at line 1238 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip