The greatest problem the country faces is crime. The best thing to do is to not act like a tourist, and do not display items of extreme wealth such as laptops, jewellery, etc. Also avoid carrying large amounts of money with you.
Brazilians seems to be honest and genuinely friendly, but many are used to small acts of corruption in their everyday lives. For instance, a vendor may try to sell goods at higher prices, or a taxi driver may choose the longest route to the destination. It doesn't mean that you can't trust anyone, just that you have to be a bit more alert and careful, particularly if someone seems too friendly.
It is also noteworthy that some Brazilians are fanatical about football (soccer) and so there are (some times violent) disputes between teams from different cities (and rivalry between teams of the same city), and walking with the shirt of a team in certain areas may be seen as controversial or even dangerous. In addition, you should never praise the Argentine team or compare them both.
Be aware and be respectful when discussing racial relations in Brazil; do not assume you understand Brazil's history of racial inequality and slavery better than a Brazilian person of color.